Logger Usage Inquiry
I could not find a right forum for my simple inquiry about Logger (either JBoss, Apache, or Java API).
What are you guys using for the message with exception?
I never use those for exception part. I tend to use for warn, error, and fatal.
What is the purpose to include these methods with parameterized exception? I assumed that exception is designed for warn, error and fatal.
Here is the link to logger java API documentation: Logger API
Have a look!
Those methods don't exist in the Java Logger, so which Logger are you referring to?
Logger (JBoss/Common API)
trace(Object message, Throwable t);
debug(Object message, Throwable t);
info(Object message, Throwable t);
Logging Library (Version 1.0.2)
trace(java.lang.Object message, java.lang.Throwable t);
debug(java.lang.Object message, java.lang.Throwable t);
info(java.lang.Object message, java.lang.Throwable t);
same link as above.
log(Level level, String msg, Throwable thrown);
You can use trace, debug or info for parameterized level.
@goldest: Yes, I did look at all APIs but they did not provide the information what kind of message to provide for trace, debug or info with their exception message.
My question is: Throwable/Error/Exception are something that went wrong. The errors/faults are logged by warn, error or fatal. What do they use for trace, debug and info because they have Throwable object in their parameters?
I suspect it's purely standardisation of the interface.
In the case of the JDK, well it's a single method so what would you have them do?
In the case of the other two, they already have an error() and a warning() method, so they supplied the others to match.
There are instances when you catch an exception and do not want to actually deal with it (that is it's almost an expected outcome for certain situations) so you don't want to flag it as an error or a warning, so might log it as debug.
Under same topic but different subject:
I goggled up for some logging standards/guidelines. I only found for trace and debug but nothing for other levels (info, warn, error, and fatal). Anyone have good examples of logging pattern usage for me to take a look at?
In this link: It provides the logging standards/guidelines for the logging pattern for trace and debug.
Java Logging Standards and Guidelines
I need more information for other level logging.