Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 80470 invoked from network); 17 Dec 2010 14:17:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Dec 2010 14:17:09 -0000 Received: (qmail 5753 invoked by uid 500); 17 Dec 2010 14:17:09 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 5573 invoked by uid 500); 17 Dec 2010 14:17:07 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET User" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 5563 invoked by uid 99); 17 Dec 2010 14:17:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Dec 2010 14:17:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rosshinkley@gmail.com designates 209.85.213.47 as permitted sender) Received: from [209.85.213.47] (HELO mail-yw0-f47.google.com) (209.85.213.47) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Dec 2010 14:16:58 +0000 Received: by ywi6 with SMTP id 6so324128ywi.34 for ; Fri, 17 Dec 2010 06:16:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=FFenXWVjo8t52UZS/2thWHqZfYV5U4q3GXnkd3z9LNM=; b=nqxhGoSxrqSdiHPDNsr8KxOspNz7wpK86F90R8GGYvVB1myIAdmeGI7vWAuynrzx24 4wrHjudBopstmSWLfXvtb027izQYK6in7VhNw3xZHiRT9YVnvpb+Z96VyOpVN1ekXo2p dEJJd7ES+7FJVoUOQTv8yDedUFcMKuswpagZ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=t8exe+Y8y+Hlb5HuQjQl+ILyoFVqp2ufxr6wRpSbiGhXNv1U/6t05cNp087o2NC0/C 15WJdfaqsWlbIaEOF6QNu0+lQqHEoB6LQ75AS13rZZhGq1MgldAjP/018fBIMNZYVpCI U31bVOEsWgI90X2XivSb90QY4fM5QKio8tIPI= Received: by 10.236.108.177 with SMTP id q37mr1417523yhg.50.1292595397548; Fri, 17 Dec 2010 06:16:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.105.207 with HTTP; Fri, 17 Dec 2010 06:16:17 -0800 (PST) In-Reply-To: References: From: Ross Hinkley Date: Fri, 17 Dec 2010 08:16:17 -0600 Message-ID: Subject: Re: Piping log messages to different appenders via LEVEL To: Log4NET User Content-Type: multipart/alternative; boundary=90e6ba5bca2d825c5b04979bd17c X-Virus-Checked: Checked by ClamAV on apache.org --90e6ba5bca2d825c5b04979bd17c Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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.stocholm@ciber.dk> wrote: > Hi Ross, > > > > Thank you very much =96 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 -element =93up=94 solved = the > problem. I dropped the -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.stocholm@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 containe= d > 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 inten= ded > recipient of this message, please immediately notify the sender and promp= tly > delete this message. > > > > *From:* Ross Hinkley [mailto:rosshinkley@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.AppenderSk= eleton.Threshold.html > > I've modified your configuration below; I think it's correct. Let me kno= w > if you have trouble with it. > > -Ross > > On Thu, Dec 16, 2010 at 8:12 AM, Jesper Lund Stocholm < > jesper.stocholm@ciber.dk> wrote: > > I would like to send log messages to one of two appenders depending on th= e > level of the message. Specifically, I=92d like this: > > > > Everything: send to Console > > Error and above: send to file > > > > So I have configured these two appenders: > > > > > > > > > %logger %ndc - %message%newline" /> > > > > > > > > log4net.Appender.RollingFileAppender"> > > > > > > > > > > > > > > > %logger %ndc - %message%newline" /> > > > > > > > > > > > > > > I would have thought that adding the -element to the > RollingFileAppender would filter the messages only saving the messages wi= th > level =93ERROR and above=94, but everything still gets send to both appen= ders. > > > > Can you tell me what I am missing here? > > > > Thanks, > > > > :o) > > > > Med venlig hilsen / Best regards > > > > Jesper Lund Stocholm > > Seniorarkitekt / Senior architect > > > > > --90e6ba5bca2d825c5b04979bd17c Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Oh, oops, I thought I took that out.=A0 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.stocho= lm@ciber.dk> wrote:

Hi Ross,

=A0

Thank you very much =96 it now wor= ks like a charm. Looking at the SDK (again), I now realized that the object= model mirrors the configuration template (or vice versa). Moving the <T= hreshold>-element =93up=94 solved the problem. I dropped the <evaluat= or>-element from my RollingFileAppender at the same time.

=A0

Thanks for your inp= ut :o)

=A0

=A0

=

Med venlig hils= en / Best regards

=A0

<= span style=3D"font-size: 10pt; color: navy;" lang=3D"EN-US">Jesper Lund Sto= cholm

=A0

CIBER Danmark A= /S

Mobil: +45 3094 5570

Email:= jes= per.stocholm@ciber.dk

=A0

CONFIDENTIALITY NOTIC= E AND NOTICE REGARDING NO ELECTRONIC SIGNATURE: The materials in this elect= ronic transmission (including attachments) may be subject to attorney-clien= t or work product privilege, may be private and confidential and are the pr= operty of the sender. The information contained is intended only for the na= med addressee(s) and should not be considered evidence of intent to be boun= d 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.

=A0

From: Ross Hinkley [mailto:rosshinkley@gmail.com]
Sent: Thursday, December 16, 2010 4:38 PM
To: Log4NET User=
Subject: Re: Piping log messages to different appenders via LEVE= L

=A0

You should be = able to use the Threshold tag under the appender to specify what level you&= #39;d like to start logging.=A0 The threshold is inclusive.

The log4= net 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.= =A0 Let me know if you have trouble with it.

-Ross

On Thu, Dec 16, 2010 at 8:12 AM, Jesper Lund Stocholm <jesper.stocholm= @ciber.dk> wrote:

I would like to send = log messages to one of two appenders depending on the level of the message.= Specifically, I=92d like this:

=A0

Everything: send to Console

Error and above: send to= file

=A0

<= p class=3D"MsoNormal"> So I have configured these two appenders:

=A0

<appender = name=3D"Console" type=3D"log4net.Appender.ConsoleAppender">
=A0=A0=A0=A0=A0=A0=A0=A0 <threshold value=3D"ALL" />

=A0=A0=A0 <layout type= =3D"log4net.Layout.PatternLayout">

=A0=A0=A0=A0=A0 <conversionPattern value=3D"%date %-4timestamp [%thread]= %-5level %logger %ndc - %message%newline" />

=A0=A0=A0 </layout>

</appender= >

=A0

<appender name=3D"RollingFileAppender<= /span>" =3D"log4net.Appender.RollingFileAppender">
=A0 <threshold value=3D"ERROR" />

=A0 <file value=3D"C:\Windows\Temp\servicelog_01.txt" />

=A0 <appen= dToFile value=3D"= ;true" />

=A0 <locki= ngModel type=3D"= log4net.Appender.FileAppender+MinimalLock" />

=A0 <rolli= ngStyle value=3D"= ;Size" />

=A0 <maxSi= zeRollBackups value=3D"10" />

=A0 <layou= t type=3D"log4net.Layout.PatternLayout">

=A0=A0=A0 <conversionPattern value= =3D"%date %-4timestamp [%thread] %-5l= evel %logger %ndc - %message%newline" />

=A0 </layo= ut>

=A0 <evalu= ator type=3D"log4net.Core.LevelEvaluator">

=A0=A0=A0 <threshold value=3D&q= uot;ERROR"/>

=A0 </eval= uator>

</appender= >

=A0

I would have thought that adding the <evaluat= or>-element to the RollingFileAppender would filter the messages only sa= ving the messages with level =93ERROR and above=94, but everything still ge= ts send to both appenders.

=A0

Can you tell me what I am missing here?

=A0

Thanks,

=A0

:o)

=A0

<= p class=3D"MsoNormal"> Med venlig hilsen /= Best regards

=A0

Jesper Lund Stocholm

Seniorarkitekt / Senior architect

=A0

=A0


--90e6ba5bca2d825c5b04979bd17c--