logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: survey: Is the FATAL priority level useful?
Date Mon, 18 Feb 2002 22:16:51 GMT
Trent,

The following quote is from the log4j book I am currently writing. You might
find the quote useful.

It is not always easy to decide when to use which level. In fact, a
decision needs to be made on each logging statement - that is on
countless occasions. To ease the pain of deciding, log4j deliberately
offers a limited set of "self-evident" levels. The FATAL level is
rarely used and usually implies the impending crash of the application
or the relevant sub-component. The ERROR level is encountered more
frequently, usually following a Java exception. Error conditions do
not necessarily cause the application to crash and the application may
continue to service subsequent requests. The WARN level is indicative
of minor problems caused by factors external to the application such
as missing or inconsistent input parameters supplied by the user.

These first three levels, are associated with problems. In contrast,
the INFO level is associated with significant events in the normal
life-cycle of the application. The DEBUG level is associated with
minor and frequently occurring but otherwise normal events.  Deciding
whether an event is significant or minor depends on many factors such
as the time, the application development stage, the component doing
the logging and the personal tastes of the developer. In the general
however, the frequency of the events is a useful yardstick for
differentiating between the INFO and DEBUG levels.  Admittedly, even
with only five levels the choice is not easy. After some discussion,
most development teams set their own rules for using levels. Some
teams even decide to extend the predefined set of five levels. It is
important to realize that levels are fundamentally just a way to
filter log requests; that is their main function.

Regards, Ceki

At 13:52 18.02.2002 -0800, Trent Mick wrote:

>Hello,
>
>I am currently specing out a core logging module for the Python language
>which borrows from log4j. I would like to know if, in practice, people have
>found the FATAL priority level of use in a language with exception handling
>support.
>
>The way I see it (not having the benefit of experience) the ERROR level is
>useful for identifying errors in user input before terminating processing (or
>stumbling along afterward). A FATAL problem is typically just an uncaught
>exception -- and if the exception is uncaught there really seems no
>appropriate to actually *log* the problem.
>
>The only appropriate senario that I see is having one exception catch
>block around my entire application which will log a FATAL error for any
>unexpected exception.
>
>     public class MyApp {
>         static Logger logger = Logger.getLogger(MyApp.class);
>
>         public static void main(String[] args) {
>             try {
>                 return dostuff();
>             } catch (Throwable t) {
>                 logger.fatal("Something really bad happened.");
>             }
>         }
>     }
>
>Are there other usage scenarios for which people have found FATAL to be
>handy.
>
>Thanks,
>Trent


--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message