[jboss-dev-forums] [Design of OSGi Integration] - Re: Logging and Exception Handling

adrian@jboss.org do-not-reply at jboss.com
Fri Feb 29 10:52:50 EST 2008


"johnbailey" wrote : 
  | I would also like to know if there are any ground rules on logging and Exception handling to follow.

They're on the WIKI somewhere.

Basically:
ERROR - if a system admin would need to know (but only if you handle the error - don;t log and rethrow that just leads to duplicate logging!)
WARN - may be a problem but you can recover
INFO - is this something somebody is likely to find really useful?
DEBUG - deployment time or other low volume logging 
TRACE - Everything else you might need to understand what happened

e.g. in your example


  | public URL getEntry()
  | {
  |     try
  |     {
  |          ...
  |     }
  |     catch (Exception e)
  |     {
  |        if (log.isTraceEnabled())
  |           log.trace("Error getting entry: " + entry, e);
  |        return null;
  |     }
  | }
  | 

Dont use isXEnabled for anything but TRACE.
All other logging should be such low volume that it isn't necessary
and probably redundant.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133264#4133264

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133264



More information about the jboss-dev-forums mailing list