Snipplr - robyyhttp://snipplr.com/users/robyy
Recent snippets posted on Snipplr.comen-usFri, 18 Aug 2017 15:01:01 GMT(Java) Logginghttp://snipplr.com/view/65607/logging/
Now you are ready to log to your heartâ€™s content. Keep in mind that all messages
with level INFO, WARNING, and SEVERE show up on the console. Therefore, reserve these
levels for messages that are meaningful to the users of your program. The level FINE
is a good choice for logging messages that are intended for programmers.
Whenever you are tempted to call System.out.println, emit a log message instead:
logger.fine("File open dialog canceled");
It is also a good idea to log unexpected exceptions. For example:
try
{
. . .
}
catch (SomeException e)
{
logger.log(Level.FINE, "explanation", e);
} ]]>Thu, 14 Jun 2012 03:52:58 GMThttp://snipplr.com/view/65607/logging/