Thank, Scott. This should give me what I need.
Regards, Frank --- Scott Deboy <[EMAIL PROTECTED]> wrote: > See the filter javadocs. > > > Here's an example > <appender name="console" class="org.apache.log4j.ConsoleAppender"> > <layout class="org.apache.log4j.SimpleLayout"/> > <filter class="org.apache.log4j.varia.ExpressionFilter"> > <param name="Expression" value="logger == p1 && NDC.userid == > u23" /> > <param name="AcceptOnMatch" value="true"/> > <param name="ConvertInFixToPostFix" value="true"/> > </filter> > <filter class="org.apache.log4j.varia.DenyAllFilter"/> > </appender> > > Notice in appenderSkeleton's doAppend method, filters are processed in > order. > http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4 > j/AppenderSkeleton.java?rev=1.26&view=auto > > Scott > > -----Original Message----- > From: F Kurzawa [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 27, 2004 11:47 AM > To: Log4J Users List > Subject: RE: Decorating output before RollingFileAppender > > > This looks interesting and leaning towards what would suit me. > > Forgive my ignorance, but I haven't seen any examples of how to use a > filter in a configuration file. Can you point me to some examples? > > Thanks, > > Frank > > > --- Scott Deboy <[EMAIL PROTECTED]> wrote: > > > I have written a couple of filters that 'decorate' logging events - > > that may be a better route to go. See PropertyFilter and > > ReflectionFilter > > here: > > > http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4 > > j/varia/ > > > > In particular, ReflectionFilter sets the 'renderedMessage' on the > > event, which would probably be what you want to do. You may want to > > consider relying on the Expression mechanism (see ExpressionFilter in > > the same > > package) as a flexible way to determine which events have the filter > > applied. > > > > I haven't worked much with PaternLayout so I'm not sure how you would > > use it in a filter. > > > > Scott > > > > -----Original Message----- > > From: F Kurzawa [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 27, 2004 10:37 AM > > To: Log4J Users List > > Subject: RE: Decorating output before RollingFileAppender > > > > > > Hi Yoav, > > > > I might be able to do what I want by extending RollingFileAppender, > > but a simpler solution for me would probably be to extend > > AsyncAppender to accept a PatternLayout parameter and then apply it > > before outputting to the next appender. > > > > Regardless, I was really hoping for a solution that would not require > > extending log4j. I was hoping there was a way to decorate log entries > > "inline" by passing them through some sort of filter, much the way > > that AsyncAppender acts as a filter of sorts in front of another > > appender. > > > > Regards, > > > > Frank > > > > > > --- "Shapira, Yoav" <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, > > > You can always extend either RollingFileAppender or PatternLayout to > > > suit your own needs. That's a big plus of open-source and our ASF > > > license ;) > > > > > > Yoav Shapira > > > Millennium Research Informatics > > > > > > > > > >-----Original Message----- > > > >From: F Kurzawa [mailto:[EMAIL PROTECTED] > > > >Sent: Tuesday, July 27, 2004 12:37 PM > > > >To: Log4J Users List > > > >Subject: RE: Decorating output before RollingFileAppender > > > > > > > >Hi James, > > > > > > > >Sorry I wasn't clearer. > > > > > > > >I need to be able to decorate the output BEFORE > > > >RollingFileAppender. > > > This > > > >is > > > >because I need to have different lines laid out out differently > > > depending > > > >on > > > >which logger that they came from. I don't have enough control with > > > >the single PatternLayout within RFA to get the different formatting > > > > >that I need. > > > > > > > >The intuitively obvious approach was to use multiple > > > RollingFileAppenders, > > > >each > > > >of which would write to the same file. But RollingFileAppender > > > >becomes > > > very > > > >confused if other RFA's are writing to the same file, and the file > > > starts > > > >getting rotated willy-nilly as each RFA steps on the other. > > > > > > > >So that approach won't work. > > > > > > > >Regards, > > > > > > > >Frank > > > > > > > >--- James Stauffer <[EMAIL PROTECTED]> wrote: > > > > > > > >> RollingFileAppender extends FileAppender so it takes a > > > >> PatternLayout > > > >also. > > > >> > > > >> James Stauffer > > > >> > > > >> > > > >> -----Original Message----- > > > >> From: F Kurzawa [mailto:[EMAIL PROTECTED] > > > >> Sent: Tuesday, July 27, 2004 10:55 AM > > > >> To: Log4J Users List > > > >> Subject: Decorating output before RollingFileAppender > > > >> > > > >> > > > >> I want to format and modify my log4j output prior to sending to a > > > >> RollingFileAppender. > > > >> > > > >> If there were functionality that would allow me to easily apply a > > > >> PatternLayout prior to sending to a RollingFileAppender that > would > > > >> be > > > >ideal. > > > >> > > > >> I can insert an AsyncAppender before my RollingFileAppender, but > > > >> AsyncAppender does not take a PatternLayout parameter so it > doesn't > > > help. > > > >> > > > >> In fact, the only two appenders that take PatternLayout arguments > > > >> are > > > the > > > >> *FileAppender's and ConsoleAppender. > > > >> > > > >> Is there a simple way to decorate my output with a PatternLayout > > > >> (or > > > some > > > >> similar functionality) prior to its arrival in a > > > >> RollingFileAppender? > > > >> > > > >> Thanks in advance, > > > >> > > > >> Frank > > > >> > > > > > > ===== > > Frank Kurzawa > > Topaz Software > > [EMAIL PROTECTED] > > > > > > > > __________________________________ > > Do you Yahoo!? > > Y! Messenger - Communicate in real time. Download now. > > http://messenger.yahoo.com > > > > --------------------------------------------------------------------- > > 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] > > > > > > > ===== > Frank Kurzawa > Topaz Software > [EMAIL PROTECTED] > > > > __________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - Send 10MB messages! > http://promotions.yahoo.com/new_mail > > --------------------------------------------------------------------- > 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] > > ===== Frank Kurzawa Topaz Software [EMAIL PROTECTED] __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]