logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric.W...@bcbsks.com
Subject Re: I don't like the word "FATAL"
Date Wed, 04 Apr 2007 16:55:07 GMT

There are messages I want to print all the time, such as entry/exit into
main(), regardless what threshold the user has set.  I've been doing
this with logger.fatal().  Unfortunately, this prints "FATAL" in your
simple message, which alarms the *hell* out of customers.  Even though
the message says something innocuous like "Entering main - processing
beginning", I've had customers require huge write-ups explaining that
FATAL isn't actually a FATAL error.  Is there a way to either change the
word "FATAL" or get a message to print in all circumstances without the
word FATAL appearing?  As I'm writing this, I'm all of a sudden thinking
that I could use a different logger with a different conversionpattern,
one without the level in it.  Is that how others do this?



I would create a new "root" logger in your config file and use it to do
INFO messages and set
the threshold to INFO.  My example is below

# WAMLogger is a Logger used to create an Audit trail for WAM usage
# Use below line in the classes to log to this Logger:
# Logger wamLog = Logger.getLogger("WAMLogger." +
log4j.logger.WAMLogger=INFO, WAMRolling

# WAMRolling is a Rolling File Appender that outputs log records to a
rolling log file named wam_Rolling_log
log4j.appender.WAMRolling.layout.ConversionPattern=[%d{ISO8601}]   %30.80
c{9} -- %x%n  ** Audit Message: %m%n

# Set the max size of the file, the number of backup files and logging

In the above config file example, if I log to wamLog.info(), I will always
get the log record to come out no
matter what the root logger setting.  The "WAMLogger." becomes another
"root" logger and will still
have the class name in the category with "WAMLogger." as a prefix.  This is
a great solution for many
things once someone showed it to me last month.

Eric Wolf

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message