Java 5 has introduced many features that can be make logging statements less cluttering, such as variable number of arguments and printf. That can alleviate all the message building code that happens when something is logged, as well as the surrounding if.
For example, instead of writing:
if (log.isDebugEnabled()
{
log.debug("User ...
At my workplace, we have lab machines that we use to do our testing.
The standard procedure to reserve a machine for testing was to walk around the office to make sure that no one was using the machine.
This is highly inefficient and time consuming.
At first, I set up a web page where people could reserve the lab machine but nobody...
What is the best way to write minimal error logs in an ASP.NET 2.0 web page or web service? For my purposes it'd be best if this was vanilla, and the implementation would work through IIS's virtual directories. I'm currently using the standard TextWriterTraceListener, but it doesn't seem to write to the virtual directory.
FYI - the Te...
I want to have a diagnostic log that is produced by several tasks managing data. These tasks may be in multiple threads. Each task needs to write an element (possibly with subelements) to the log; get in and get out quickly. If this were a single-task situation I'd use XMLStreamWriter as it seems like the best match for simplicity/funct...
I'm noticing some weird behavior using standard logging during JUnit tests. Does JUnit redirect standard output to a different stream? How can I get access to that?
Here's a simple JUnit test that demonstrates the behavior I'm describing.
@Test
public void logMessage() {
// set up new logger with output directed to standard out
...
I'm looking for a C# example showing how to access a remote SOAP Web Service, and logging (to a file, or even just to a string I can do whatever with) all complete raw SOAP requests and complete raw SOAP responses.
I found some other posts on StackOverflow with similar topics, but they seem to reference a web.config file, which my desk...
I'm running a webapp using the included tomcat server in NetBeans. NetBeans shows me the Tomcat log in the output window, but I also want to see my webapp's log. Is this possible? Can I configure NetBeans to do this? I can't find any options in the server or project settings so far...
...
I have two processes that I have up and running and I am doing logging from. One is a client the other is a webservice. I want to setup a central log system where I can track logs and interactions between processes -- for instance I want to be able to associate calls made from the client to the webservice when I look at the logs. I guess...
How can one quickly turn off all Log4J output using a log4j.properties file?
...
I am looking for best practices to implement a TraceListener that will write logs inside SQL server from an ASP.NET application.
What are the things that should be taken into account when implementing such a class in order to avoid performance reduction?
Will stored procedures be faster than plain ADO.NET INSERT statements?
I reall...
I'd like to get stories on how people are handling tracing and logging in real applications. Here are some questions that might help to explain your answer.
Frameworks
What frameworks do you use?
log4net
System.Diagnostics.Trace
System.Diagnostics.TraceSource
Logging application block
Other?
If you use tracing, do you make use of ...
In this thread many people have indicated that they use log4net. I am a fan of TraceSources and would like to know why log4net is used.
Here is why I like trace sources:
Pluggable listeners - XML, TextFile, Console, EventLog, roll your own
Customisable trace switches (error, warning, info, verbose, start, end, custom)
Customisable co...
In weblogic I can configure in the console for the Serverlog to use log4j instead of default JDK logging.
However the serverlog is not using a log4j.properties file, but seems to use the configuration in config.xml
Even if the log4j.properties file is in the classpath and I set these properties:
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j....
What's the safest way to truncate the MySQL slow query log (under Linux primarily, but Windows would be handy to know) while MySQL is running?
By safe I mean:
Mustn't cause any permissions problems
Mustn't jump back to its original size next time its appended to
...
I have a library that writes to stdout in Java. I would like to capture this output in a log using log4j. (I didn't write this library, so I have no control over the code inside the library).
Is there an easy way to do this? Is System.setOut the right approach? What do I pass to System.setOut?
Also, how would you do this in .NET/C#...
I want to be able to pull in the error log from BIOS across a network. Looking at Win32_BIOS in MSDN I did not see anything defining the error log. Would love to do this in C# with WMI, but am open to suggestions. Is it possible?
Edit: Win32_BIOS does not have a property (don't know if that is the right term) that contains the BIOS erro...
I am trying to compile the code from here: http://www.brackeen.com/javagamebook/#download (Chapter 6) and am having trouble. I don't understand how java.util.logging.Logger and log4j work together, but that seems to be the issue. The errors I get are all on the log.error() or log.warn() method calls.
Here is the output from NetBeans:
...
In my current project I'm using two libraries where one is using log4net and the other NLog for its logging. I'm personally prefer NLog so it is used in my application as well.
I'm not knowing much about log4net so I'm asking what would be the best way to programmatically forward all the messages from log4net to NLog.
There is a post a...
I'm developing a (internal) library where I want to enforce that developers using this lihrary include a text ID when logging error or fatal level messages. Without modifying log4j, what we want to enforce is similar to:
logger.error( "E1234:An error has occured" );
With none or minor extension to log4j we could either, during nightly ...
Do any of the well-known PHP debuggers offer any method of logging stack traversal? Say I wanted to somehow store a log of every entry/exit of every class, class method, and function.
Is there any way to do this all on the server side (maybe some sort of plaintext client that could log every step-in/step-out automatically)?
Update: It ...