Results 1 to 6 of 6
Thread: Logger Usage Inquiry
- 01-05-2011, 12:06 AM #1
Member
- Join Date
- Dec 2008
- Location
- Colorado Springs
- Posts
- 5
- Rep Power
- 0
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?
Ex.
log.trace("Message", ex);
log.debug("Message", ex);
log.info("Message", ex);
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.
Thank you,
TT
- 01-05-2011, 06:16 AM #2
Here is the link to logger java API documentation: Logger API
Have a look!
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-05-2011, 09:03 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Those methods don't exist in the Java Logger, so which Logger are you referring to?
- 01-05-2011, 06:45 PM #4
Member
- Join Date
- Dec 2008
- Location
- Colorado Springs
- Posts
- 5
- Rep Power
- 0
For JBoss:
Logger (JBoss/Common API)
trace(Object message, Throwable t);
debug(Object message, Throwable t);
info(Object message, Throwable t);
For Apache:
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);
For Java:
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?
Thank you,
TT
- 01-06-2011, 08:38 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 03-24-2011, 04:31 PM #6
Member
- Join Date
- Dec 2008
- Location
- Colorado Springs
- Posts
- 5
- Rep Power
- 0
Logging Patterns
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.
Thanks!
Similar Threads
-
A better Java logger
By tony-walker in forum Reviews / AdvertisingReplies: 0Last Post: 09-09-2010, 01:32 PM -
Logger + FileHandler problems
By JonJacobs in forum New To JavaReplies: 11Last Post: 08-19-2010, 02:19 PM -
Logger and file lock
By segolas in forum Advanced JavaReplies: 3Last Post: 01-14-2010, 04:02 PM -
JAMWiki Inquiry
By Boer84 in forum New To JavaReplies: 0Last Post: 06-19-2008, 05:32 PM -
Help with key Logger in java
By paul in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:14 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks