Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 27558 invoked from network); 7 Oct 2005 19:09:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Oct 2005 19:09:48 -0000 Received: (qmail 74077 invoked by uid 500); 7 Oct 2005 19:09:47 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 74060 invoked by uid 500); 7 Oct 2005 19:09:47 -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 74048 invoked by uid 99); 7 Oct 2005 19:09:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2005 12:09:47 -0700 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [206.190.37.245] (HELO web54110.mail.yahoo.com) (206.190.37.245) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 07 Oct 2005 12:09:49 -0700 Received: (qmail 13377 invoked by uid 60001); 7 Oct 2005 19:09:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=PD2MLIvVqvj6Jz4Yz1kQWJKx9GnCR9CsmUVqfdEB774mDu/amevc5mEw+9T+77Qh6eXAogHZwQwfh86x4WuqHet4ZmfaUUcOy4TlOkCoNHhcRq58dUfkz3P2w/yrDmgLfF85cREIIyhHay1SEXmSScCKDQcxvp0fMNhszdayKUI= ; Message-ID: <20051007190923.13375.qmail@web54110.mail.yahoo.com> Received: from [143.182.124.4] by web54110.mail.yahoo.com via HTTP; Fri, 07 Oct 2005 12:09:23 PDT Date: Fri, 7 Oct 2005 12:09:23 -0700 (PDT) From: Shireesh Thanneru Subject: Re: different levels for appenders To: Log4NET User In-Reply-To: <20051007185509.19174.qmail@web32412.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1638424208-1128712163=:13040" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --0-1638424208-1128712163=:13040 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Yes, that is possible. Here is how you can do that. Notice the tag for the EventLogAppender. Thanks, Shireesh Thanneru jcmag wrote: Hello, I would like to know if different appenders could have different levels of logging. In my project I have a RollingLogFile appender and an EventLog appender; I would like to log all messages (level=ALL) in the file and only ERROR messages in the eventLog, is it possible ? Thanks JC __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com --0-1638424208-1128712163=:13040 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Yes, that is possible.
 
Here is how you can do that. Notice the <threshold> tag for the EventLogAppender.

 

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">

<file value="rolling-log-file.log" />

<appendToFile value="true" />

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

<maximumFileSize value="100KB" />

<maxSizeRollBackups value="10" />

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="%date{ISO8601} %-5level %logger - %message%newline" />

</layout>

</appender>

 

<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="%date{ISO8601} %-5level %logger - %message%newline" />

</layout>

<threshold value="ERROR" />

</appender>


<root>

<level value="ALL" />

<appender-ref ref="RollingFileAppender" />

<appender-ref ref="EventLogAppender" />

</root>

 

Thanks,

 

Shireesh Thanneru


jcmag <jcmag@yahoo.com> wrote:
Hello,

I would like to know if different appenders could have
different levels of logging.
In my project I have a RollingLogFile appender and an
EventLog appender; I would like to log all messages
(level=ALL) in the file and only ERROR messages in the
eventLog, is it possible ?

Thanks

JC



__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--0-1638424208-1128712163=:13040--