Results 1 to 6 of 6
  1. #1
    Turyturbo is offline Member
    Join Date
    Dec 2008
    Location
    Colorado Springs
    Posts
    5
    Rep Power
    0

    Default 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

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Wink

    Here is the link to logger java API documentation: Logger API

    Have a look!

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

  3. #3
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default

    Those methods don't exist in the Java Logger, so which Logger are you referring to?

  4. #4
    Turyturbo is offline Member
    Join Date
    Dec 2008
    Location
    Colorado Springs
    Posts
    5
    Rep Power
    0

    Default

    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

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default

    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.

  6. #6
    Turyturbo is offline Member
    Join Date
    Dec 2008
    Location
    Colorado Springs
    Posts
    5
    Rep Power
    0

    Default 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

  1. A better Java logger
    By tony-walker in forum Reviews / Advertising
    Replies: 0
    Last Post: 09-09-2010, 01:32 PM
  2. Logger + FileHandler problems
    By JonJacobs in forum New To Java
    Replies: 11
    Last Post: 08-19-2010, 02:19 PM
  3. Logger and file lock
    By segolas in forum Advanced Java
    Replies: 3
    Last Post: 01-14-2010, 04:02 PM
  4. JAMWiki Inquiry
    By Boer84 in forum New To Java
    Replies: 0
    Last Post: 06-19-2008, 05:32 PM
  5. Help with key Logger in java
    By paul in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 05:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •