For the console requirement a good starting point would be to use the
appender's threshold property to make it record warning level or higher
messages:
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<threshold value="WARN"/>
<!-- other properties -->
</appender>
One way to accept messages that have exceptions would be to write a filter:
// untested
public class AcceptMessagesWithExceptionFilter : FilterSkeleton
{
public override FilterDecision Decide(LoggingEvent loggingEvent)
{
return (loggingEvent.ExceptionObject != null) ? FilterDecision.Accept :
FilterDecision.Deny;
}
}
To
use that class, you need to add a filter element to your appender
configuration node (similiar to how I added a threshold node in my
first example):
<filter type="Company.Logging.AcceptMessagesWithExceptionFilter,
Company.Logging">
----- Original Message ----
From: rohit behl <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, December 1, 2006 12:07:46 PM
Subject: logging exception messages
Hi
We want to log all the exception messages to a log file and only print the
error and warning messages to the console.
Please let me know if you need more information.
Thanks in advance.
Regards
Rohit
Everyone is raving about the all-new Yahoo! Mail beta.