Java logging framework: Difference between revisions

Content deleted Content added
M0smith (talk | contribs)
mNo edit summary
M0smith (talk | contribs)
Line 3:
==Functionality Overview==
===Logger===
Most frameworks support a the notion of a Logger. A Logger is an object that allows the application to log data without regard to where the data is actually logged. The application logs a message in the form of an object or and object and and exception. The message is logged at a certain level. The common levels are, copied from [http://jakarta.apache.org/commons/logging/guide.html#Message_Priorities_Levels Jakarta Commons Logging]:
{| border=1 cellspacing=0 cellpadding=5
|FATAL
|Severe errors that cause premature termination. Expect these to be immediately visible on a status console.
|An error that the application cannot recover from
|-
|ERROR
|Other runtime errors or unexpected conditions. Expect these to be immediately visible on a status console.
|An error has occured, though not a fatal error
|-
|WARNING
|Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". Expect these to be immediately visible on a status console.
|what is a warning
|-
|INFO
|Interesting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum.
|What is info
|-
|DEBUG
|detailed information on the flow through the system. Expect these to be written to logs only.
|Development debug message
|-
|TRACE
|more detailed information. Expect these to be written to logs only.
|Ttace the proggram flow.
|}
The logging framework maintains the current logging level for each logger. The logging level can be set more or less restrictive. For example, if the logging level is set to "WARNING", then all messages of that level or higher are logged, ERROR and FATAL.
 
==Best Practices==
==Summary==