TRACE
Indicates a level of logging that shows the control flow of the program. Among the things that you’d like to log with a TRACE level are: entry and exit of a method, loop, if statement or other control flow statements. Think of this level as the method that you should use for all logging that you’d do while tracking a _specific_ problem and that you’d most probably get rid of, once you’ve found the problem.
Example:
logger.trace(“before if(i)”); if( i > 0) { logger.trace(“inside if(i)”); …. } logger.trace(“after if(i)”);
DEBUG
The DEBUG level should be used when logging anything that you’d like to be in the logs when trying to understand why the application didn’t work as expected. Think of this level as the one that you’d like to see, when you, a sip communicator developer, are running the application.
Example:
logger.debug(“Received an INVITE from “ + request.getFrom().toString()); logger.debug(“An incoming media stream has been detected from” + stream.getIPAddress());
INFO
Indicates a level of detail that a knowledgeable user would like to have when running the program. Think of it as all the messages you’d like to see in the log when running gnomemeeting for example, or in other words - anything that might help you resolve or at least identify a problem without looking in the source code.
WARN
Used for logging any unusual situation that is for the moment not preventing the application.
Example:
logger.warn(“Failed to bind to port “ + port + “ will try another one”);
ERROR
Used for logging errors that prevent the problem from functioning as expected.
Example:
logger.error(“Failed to open incoming audio stream. “ + “Reason: unknown payload.”);