Saturday, February 04, 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: Double configuration and SmtpAppender configuration
Prev Next
You are not authorized to post a reply.

Author Messages
Vladimir Kovalenko

03/02/2006 10:19 AM  

Hi, I need some help.

 

1) I want to configure log level for Log4net.MainForm logger in the following maner:

 

    <root>

      <level value="ALL" />

    </root>

 

    <logger name="Log4net.MainForm">

      <level value="WARN" />

      <appender-ref ref="CustomAppender" />

    </logger>

   

    <logger name="Log4net.MainForm">

      <level value="ALL" />

      <appender-ref ref="AdoNetAppender" />

      <appender-ref ref="SmtpAppender" />

    </logger>

 

 

This way I want AdoNetAppender and SmtpAppender to process ALL data that is passed to logger. And Only WARN and above messages are handled by my CustomeAppender. Can it be configured this way?

 

Currently the second configuration is applied, but not both.

 

2) I have SmtpAppender configured to send messages to address1@mail.com. Now I want to configure Log4net.MainForm logger to send messages to address2@mail.com. Can I do that with configuration file?

 

Best regards,

Vladimir Kovalenko

Nicko Cadell

03/02/2006 6:32 PM  

Loggers can only have one level. If you need to have more control over
the logging performed by an appender you can set its <threshold> level.
If that is not sufficient you can attach several different filters to
the appender that determine if the event should be output, you can even
write your own filters.
http://logging.apache.org/log4net/release/manual/introduction.html#filte
rs

So my suggestion would be to set the <threshold> on the CustomAppender
like so:

<root>
  <level value="ALL" />
</root>

<logger name="Log4net.MainForm">
  <appender-ref ref="AdoNetAppender" />
  <appender-ref ref="SmtpAppender" />
  <appender-ref ref="CustomAppender" />
</logger>

<appender name="CustomAppender" type="..">
  <threshold value="WARN" />
  ...
</appender>

Cheers,
Nicko

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Double configuration and SmtpAppender configuration



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