Thanks Scott, Currenlty we are using log4j1.2 , but to support filters we need to use log4j1.3 right? Will it be major changes needed to change it to higher version?
And currently we are using log4j.properties for all types of logging. In addition to that, to configure filters, we need to use log4j.xml for configuring. Can we have both the type of configurations? (i.e log4j.xml for filters and log4j.properties for others) Which one will take precedence? Regards, Praveen On 12/30/05, Scott Deboy <[EMAIL PROTECTED]> wrote: > > I don't think you can specify filters in the properties file format - use > an xml config file instead. > > Here's an example: > > <appender name="someAppender" class="org.apache.log4j.FileAppender"> > <layout class="org.apache.log4j.SimpleLayout"/> > <filter class="org.apache.log4j.varia.ExpressionFilter"> > <param name="Expression" value="msg ~= blah" /> > <param name="AcceptOnMatch" value="true"/> > <param name="ConvertInFixToPostFix" value="true"/> > </filter> > <filter class="org.apache.log4j.varia.DenyAllFilter"/> > </appender> > > The denyallfilter makes sure the events are dropped if they weren't > accepted by the expression filter. > > Scott > > -----Original Message----- > From: Praveen Kumar Hasthalapuram [mailto:[EMAIL PROTECTED] > Sent: Fri 12/30/2005 6:46 AM > To: Log4J Users List > Subject: Re: Logging custom levels using log4j > > Hi , > > We are using Struts framework for our product(application) and using > logj.properties file to configure logging. > > How can i configure Expression-based filters in log4j.properties? Is it > possible to configure in properties file? > > One more basic question, Can we use both log4j.properties and log4j.xmlfile > to configure for an application? > Could anyone clarify me. > > Thanks > -Praveen > > On 12/29/05, Praveen Kumar Hasthalapuram <[EMAIL PROTECTED]> > wrote: > > > > Thanks Scott, > > > > I think this will help me. > > > > Regards, > > Praveen > > > > On 12/29/05, Scott Deboy <[EMAIL PROTECTED]> wrote: > > > > > 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: log4j-user@logging.apache.org > > > 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] > > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >