On Dec 6, 2007, at 5:19 PM, chiran wrote:
Hi all,
It is very easy to create a custom log4j level.
All u need is the basic understanding of how the different levels are
organized.
Good example of extending levels for the right reason.
Praveen Kumar Hasthalapuram wrote:
Hi All,
I need to log specified particular type of messages to one log file
and
rest
to another log file.
For example say, if message contains "SNMP" or "CDP" and so on,
need to
log in to log1.log
and rest of the messages need to log in to log2.log
How to configure the log4j.properties to log custom levels?
Is there any provision to create custom levels and to configure it?
I heard that by Filters we can do this, It will be great if anyone
throw
some light on this.
Thanks In Advacne,
Praveen
Logger names are the best tool to separate log messages based on
target audience or topics. Levels are not intended for that purpose.
Many people assume since most examples use class names as logger
names, that that is the only pattern that is allowed and try to
overload LEVEL to indicate topic or audience. In your case, use a
logger named "snmp.whatever" or "cdp.whatever" for messages that you
may want to route to different locations.
This has been discussed many times previously, see http://permalink.gmane.org/gmane.comp.jakarta.log4j.user/15285
or search for "log4j-user custom level audience" .
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]