Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 68437 invoked from network); 19 May 2009 22:00:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 May 2009 22:00:11 -0000 Received: (qmail 17645 invoked by uid 500); 19 May 2009 22:00:24 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 17613 invoked by uid 500); 19 May 2009 22:00:24 -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 17604 invoked by uid 99); 19 May 2009 22:00:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 May 2009 22:00:24 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.208.4.195] (HELO mout.perfora.net) (74.208.4.195) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 May 2009 22:00:14 +0000 Received: from [192.168.1.138] (70-234-11-194.ded.ameritech.net [70.234.11.194]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0MKpCa-1M6XLj2Hi9-000d23; Tue, 19 May 2009 17:59:52 -0400 Message-ID: <4A132BD3.1050209@aps-technology.com> Date: Tue, 19 May 2009 14:59:47 -0700 From: Loren Keagle User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Log4NET User Subject: Re: Log not logging in custom filter References: <23624032.post@talk.nabble.com> In-Reply-To: <23624032.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+v1NOzyLi9raD0UXZg4hZuRJqK7CVbQN1A/+K k/ltZMn4SaAH4utJe+7DIaPXWUzyYnnMjByvA4efSxiMRx0yNY mTzesVQHF8EUa7YBVmKPLHIoBlKz1DD X-Virus-Checked: Checked by ClamAV on apache.org stefan.moser wrote: > I'm writing a custom filter (inherits from FilterSkeleton) and I want to log > errors inside the filter. The problem is that any log events created inside > the filter is not getting logged. Is there a special restriction that log > events cannot be created this far down inside the loggin pipeline? > > public override FilterDecision Decide(LoggingEvent loggingEvent) > { > // Do the interesting stuff > > // In some exceptional case, log an error > LogManager.GetLogger("TheLogger").Error("log message", exception); > } > > Any reason why this code wouldn't work? > Inside of the log4net framework, there is an internal logger called LogLog. It's used throughout the appender framework, but I imagine there's no problem using it in a filter. Just call: LogLog.Error("log message"); ~Loren