Oh, oops, I thought I took that out. Ah well, sounds like I got the idea across. :)
Glad it worked for you. -Ross On Fri, Dec 17, 2010 at 5:37 AM, Jesper Lund Stocholm < jesper.stoch...@ciber.dk> wrote: > Hi Ross, > > > > Thank you very much – it now works like a charm. Looking at the SDK > (again), I now realized that the object model mirrors the configuration > template (or vice versa). Moving the <Threshold>-element “up” solved the > problem. I dropped the <evaluator>-element from my RollingFileAppender at > the same time. > > > > Thanks for your input :o) > > > > > > Med venlig hilsen / Best regards > > > > Jesper Lund Stocholm > > > > CIBER Danmark A/S > > Mobil: +45 3094 5570 > > Email: jesper.stoch...@ciber.dk > > > > CONFIDENTIALITY NOTICE AND NOTICE REGARDING NO ELECTRONIC SIGNATURE: The > materials in this electronic transmission (including attachments) may be > subject to attorney-client or work product privilege, may be private and > confidential and are the property of the sender. The information contained > is intended only for the named addressee(s) and should not be considered > evidence of intent to be bound to any agreement. The taking of any action in > reliance on the contents is strictly prohibited. If you are not the intended > recipient of this message, please immediately notify the sender and promptly > delete this message. > > > > *From:* Ross Hinkley [mailto:rosshink...@gmail.com] > *Sent:* Thursday, December 16, 2010 4:38 PM > *To:* Log4NET User > *Subject:* Re: Piping log messages to different appenders via LEVEL > > > > You should be able to use the Threshold tag under the appender to specify > what level you'd like to start logging. The threshold is inclusive. > > The log4net SDK outlines how it works: > > http://logging.apache.org/log4net/release/sdk/log4net.Appender.AppenderSkeleton.Threshold.html > > I've modified your configuration below; I think it's correct. Let me know > if you have trouble with it. > > -Ross > > On Thu, Dec 16, 2010 at 8:12 AM, Jesper Lund Stocholm < > jesper.stoch...@ciber.dk> wrote: > > I would like to send log messages to one of two appenders depending on the > level of the message. Specifically, I’d like this: > > > > Everything: send to Console > > Error and above: send to file > > > > So I have configured these two appenders: > > > > <appender name="Console" type="log4net.Appender.ConsoleAppender"> > <threshold value="ALL" /> > > <layout type="log4net.Layout.PatternLayout"> > > <conversionPattern value="%date %-4timestamp [%thread] %-5level > %logger %ndc - %message%newline" /> > > </layout> > > </appender> > > > > <appender name="RollingFileAppender" type=" > log4net.Appender.RollingFileAppender"> > <threshold value="ERROR" /> > > <file value="C:\Windows\Temp\servicelog_01.txt" /> > > <appendToFile value="true" /> > > <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> > > <rollingStyle value="Size" /> > > <maxSizeRollBackups value="10" /> > > <layout type="log4net.Layout.PatternLayout"> > > <conversionPattern value="%date %-4timestamp [%thread] %-5level > %logger %ndc - %message%newline" /> > > </layout> > > <evaluator type="log4net.Core.LevelEvaluator"> > > <threshold value="ERROR"/> > > </evaluator> > > </appender> > > > > I would have thought that adding the <evaluator>-element to the > RollingFileAppender would filter the messages only saving the messages with > level “ERROR and above”, but everything still gets send to both appenders. > > > > Can you tell me what I am missing here? > > > > Thanks, > > > > :o) > > > > Med venlig hilsen / Best regards > > > > Jesper Lund Stocholm > > Seniorarkitekt / Senior architect > > > > >