You can specify a threshold value in the appender.  That would allow you to
log messages from a given level and higher.  For example, as a child to the
appender node:

<threshold value="INFO">

would log Info messages, Warning messages, and so on.  From there, you can
use Ron's suggestion for controlling what you want to see overall and to
manage multiple appenders.

If I understand your question, Omatase, it sounds like you want to log one
log level per file, maybe?  I'm not certain you can specify an upper
threshold to an appender.  I've never used log4net in such a fashion.  Does
anyone know if you can set an upper limit on an appender?

Omatase, if you need a more complete example, let me know.

-Ross

On Tue, Apr 7, 2009 at 10:14 PM, Neil Haughton <
neil.haugh...@autoscribe.co.uk> wrote:

>
> PMFBI but that would log to both appenders using the same level. Omatase
> seems to want to log to each appender using different levels to control
> each.
>
> Regards,
>
> Neil Haughton
>
>
> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabow...@yahoo.com<rongrabow...@yahoo.com>
> ]
> Sent: Wed 08/04/2009 00:09
> To: Log4NET User
> Subject: Re: Error destroying my productivity Please Help!: log4net:ERROR
> [] Attempted to append to closed appender named []
>
>
> Does this work?
>
> <logger name="Invoicing">
>   <level value="DEBUG" />
>   <appender-ref ref="AdoNetAppender" />
>   <appender-ref ref="FileAppender" />
> </logger>
>
>
> ----- Original Message ----
> From: omatase <omat...@gmail.com>
> To: log4net-user@logging.apache.org
> Sent: Tuesday, April 7, 2009 6:17:29 PM
> Subject: Error destroying my productivity Please Help!: log4net:ERROR []
> Attempted to append to closed appender named []
>
>
> I cannot figure this one out.
>
> I have been tasked by my team to create a logging service so that we can
> all
> have convenient logging without having to integrate it into our individual
> projects. I decided to do this I would just build a wrapper around log4net
> that makes it even simpler to use than it already is.
>
> After not too much work I got it up and running and (seemingly) working. I
> had it running on a development web server here for people to begin using
> with no issues initially.
>
> Now I am getting this really really really crappy error whenever I try to
> write a log no matter the loglevel or the logger being used. I have
> narrowed
> it down to config file changes but cannot find an answer.
>
> The changes I narrowed it down to are:
> If I have the following configuration in my log4net xml section everything
> is fine
>
> <root>
>   <level value="DEBUG" />
>   <appender-ref ref="AdoNetAppender" />
> </root>
>
> And if I add an additional logger suchas:
>
> <logger name="Invoicing">
>   <level value="DEBUG" />
>   <appender-ref ref="AdoNetAppender" />
> </logger>
>
> we're still in good shape. But! When I add another logger with the same
> "name" as another existing logger suchas:
>
> <logger name="Invoicing">
>   <level value="FATAL" />
>   <appender-ref ref="FileAppender" />
> </logger>
>
> all hell breaks loose and I get the following error:
>
> "log4net:ERROR [] Attempted to append to closed appender named []"
>
> I am certain log4net is supposed to support a log strategy such as this so
> that I can have fatal messages logged differently for the same logger name.
> Can someone help me understand what's going on?
>
> I can post any and all code I have if it will help diagnose the problem.
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Error-destroying-my-productivity-Please-Help%21%3A-log4net%3AERROR----Attempted-to-append-to-closed-appender-named----tp22939427p22939427.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>
>
>

Reply via email to