You can do this using log4j 1.3 using ExpressionFilter, or you could write your 
own filter that does the same thing.

Route all the events to both file appenders, and specify a different 
ExpressionFilter on each appender.

An example expression you would use with ExpressionFilter:
MSG ~= SNMP

Remember to put spaces around the operators, etc.

You can find out more information on the expression syntax by viewing Chainsaw 
V2's tutorial:
http://logging.apache.org/log4j/docs/chainsaw.html

Scott

-----Original Message-----
From: Praveen Kumar Hasthalapuram [mailto:[EMAIL PROTECTED]
Sent: Thu 12/29/2005 9:17 AM
To: [email protected]
Subject: Logging custom levels using log4j
 
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 we can do this with the use of Filters.

Could anyone suggest me better solution for this.

Thanks in Advance,
Praveen


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to