Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: (AUS1977)logging to different appenders dipending on level
Prev Next
You are not authorized to post a reply.

Author Messages
aus1977

01/30/2008 3:25 PM  

Is it possible use log to different appenders from same logger name dipending
on level.
I'll try to explane myself mor clearly  .For example we have some logger
named MyLogger so we need  this logger to log INFO messages to
ConsoleAppender,WARN messages to LogFileAppender and ERROR messages to
RollingLogFileAppender?

SOS!!!!!!!!!!!!!!!!!!

si

01/31/2008 1:15 AM  

> Is it possible use log to different appenders from same logger name dipending
> on level.

Yes, use the LevelRangeFilter inside each appenders configuration.

  <log4net>
    <appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
      ...
      <filter type="log4net.Filter.LevelRangeFilter">
        <levelMin value="INFO"/>
        <acceptOnMatch value="True"/>
      </filter>
      <filter type="log4net.Filter.DenyAllFilter"/>
    </appender>

    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
      ...
      <filter type="log4net.Filter.LevelRangeFilter">
        <levelMin value="ERROR"/>
        <acceptOnMatch value="True"/>
      </filter>
      <filter type="log4net.Filter.DenyAllFilter"/>
    </appender>

More details in the documentation.

cheers
si
--
It's a wild world that we live in, you step to the vibe like a new
found religion, take your position, compile your vision, futurism,
algorithm has risen up!                                pfm - the western

aus1977

01/31/2008 5:37 PM  

Thank you but i need it on the logger level

Ron Grabowski

01/31/2008 6:32 PM  

I don't understand what you're asking. The LevelRangeFilter uses the level of the message (i.e. the "logger level") to filter messages before the appender processes them. Why won't si-9's solution work for you?

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > (AUS1977)logging to different appenders dipending on level



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement