You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Saurabh Dani <sa...@danicorp.com> on 2006/04/06 12:24:45 UTC
Loggin to multiple appenders
Greetings All,
Is it possible to write to more than one appenders? In the FAQs I read that it is possible to do so, but could not find an example.
I would like to write the debug logs to a fileappender (if debug logging is turned on), and info logs to a database. Is this possible with log4net?
Thanks
Saurabh
Re: Loggin to multiple appenders
Posted by Matthew Brown <oc...@gmail.com>.
I believe the proper way to do this is to add a filter to each appender to
filter based on level, and then attach both appenders to the root logger
http://logging.apache.org/log4net/release/manual/configuration.html#filters
<root>
<level value="ALL" />
<appender-ref ref="FileAppender" />
<appender-ref ref="DBAppender" />
</root>
On 4/6/06, Saurabh Dani <sa...@danicorp.com> wrote:
>
> Greetings All,
>
> Is it possible to write to more than one appenders? In the FAQs I read
> that it is possible to do so, but could not find an example.
>
> I would like to write the debug logs to a fileappender (if debug logging
> is turned on), and info logs to a database. Is this possible with log4net?
>
> Thanks
> Saurabh
>