logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rutledge, J. Mike" <RUTL...@RJRT.com>
Subject RE: problems.
Date Tue, 08 Mar 2005 11:37:11 GMT
yes

-----Original Message-----
From: Barry Burton [mailto:bburtonpa@yahoo.com]
Sent: Monday, March 07, 2005 4:20 PM
To: Log4NET User
Subject: Re: problems.


Talking to myself here... :-)

No, because you're using a separate config file.  Why?


Barry




--- Barry Burton <bburtonpa@yahoo.com> wrote:

> Can we assume that you've added the following to
> your
> app.config file before the log4net section:
> 
> <configSections>
>   <section name="log4net"
>
type="log4net.Config.Log4NetConfigurationSectionHandler,
> log4net" />
> </configSections>
> 
> Barry
> 
> 
> 
> --- "Rutledge, J. Mike" <RUTLEDJ@RJRT.com> wrote:
> > 
> > I've been trying my best to find code samples for
> > using several of the appenders so I wouldn't
> bother
> > you good folks. So far I've
> > had no luck. I can find the config file entries
> but
> > nothing else.
> > 
> > Here is what I'd like to do:
> > 
> > Use the SMTPAppender and SmtpPickupDirAppender. I
> > can't get either to work.
> > I assume that in the code you don't have to tell
> it
> > what appender it is using (it's specified in the
> > config file).
> > 
> > Also, is there a way to trap errors in the logger
> > itself? With these appenders in the config file,
> it
> > prevents the fileappender from
> > working. Fileappender works when I remove the
> > SmtpPickupDirAppender references.
> > 
> > Any help would be appreciated. This is such a cool
> > tool. If I could get the email portion to work,
> that
> > and the fileappender would
> > cover 98% of what I do.
> > 
> > Thanks,
> > Rut
> > 
> > 
> > configfile
> > 
> > <?xml version="1.0" encoding="utf-8" ?>
> > <log4net>
> > 
> > <appender name="MyFirstFileAppender"
> > 	type="log4net.Appender.FileAppender">
> > 	<file value="c:\\testfile.txt" />
> > 	<appendToFile value="true" />
> > 	<layout type="log4net.Layout.PatternLayout">
> > 		<conversionPattern value="%5p %d (%c:%L) - %m%n"
> > />
> > 	</layout>
> > </appender>
> > 
> > <appender name="SMTPAppender"
> > type="log4net.Appender.SMTPAppender">
> >             <BufferSize value="1" />
> >             <param name="To"
> > value="rutledj@rjrt.com" />
> >             <param name="From"
> > value="rutledj@rjrt.com" />
> >             <Subject value="log4net Error Message"
> > />
> >             <SMTPHost value="mail.rjr.com" />
> >             <param name="LocationInfo"
> value="false"
> > />
> >             <param name="BufferSize" value="512"
> />
> >             <param name="Lossy" value="true" />
> >             <evaluator
> > type="log4net.spi.LevelEvaluator">
> >                 <param name="Threshold"
> value="ALL"
> > />
> >             </evaluator>
> >             <layout
> > type="log4net.Layout.PatternLayout">
> >                 <param name="ConversionPattern"
> > value="%n%d [%t] %-5p %c [%x] - %m%n%n%n" />
> >             </layout>
> > </appender>
> > 
> > <appender name="SmtpPickupDirAppender"
> > type="log4net.Appender.SmtpPickupDirAppender">
> > 	<to value="rut@rjrt.com" />
> > 	<from value="rut@rjrt.com" />
> > 	<subject value="test logging message" />
> > 	<pickupDir value="C:\\SmtpPickup" />
> > 	<bufferSize value="512" />
> > 	<lossy value="true" />
> > 	<evaluator type="log4net.Core.LevelEvaluator">
> > 		<threshold value="ALL"/>
> > 	</evaluator>
> > 	<layout type="log4net.Layout.PatternLayout">
> > 		<conversionPattern value="%newline%date
> [%thread]
> > %-5level %logger [%ndc] - %
> > message%newline%newline%newline" />
> > 	</layout>
> > </appender>
> > 
> > 
> > <root>
> > 	<level value="ALL" />
> > 	<appender-ref ref="MyFirstFileAppender" />
> > 	<appender-ref ref="SMTPAppender" />
> > 	<appender-ref ref="SmtpPickupDirAppender />
> > </root>
> > 
> > </log4net>
> > 
> > 
> > 
> > 
> > c# code
> > 
> > string log4netConfigFilePath = Path.Combine
> >
>
(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
> > 				"log4net.config");
> > 
> > 		
> >
> log4net.Config.DOMConfigurator.ConfigureAndWatch(new
> > 				FileInfo(log4netConfigFilePath));
> > 
> > 			log4net.Config.DOMConfigurator.Configure();			
> > 			log4net.ILog log  =
> > log4net.LogManager.GetLogger(typeof(Form1));
> > 				
> > 			try
> > 			{
> > 				log.Info("NEW");
> > 				log.Info("Another");
> > 			}
> > 			catch
> > 			{
> > 				MessageBox.Show("here");
> > 			}
> > 
> 
> There are only 10 types of people in the world -
> Those who understand binary, and those who don't.
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 


There are only 10 types of people in the world - Those who understand binary, and those who
don't.


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

-----------------------------------------
CONFIDENTIALITY NOTE:  This e-mail message, including any  attachment(s),
contains information that may be confidential,  protected by the attorney-
client or other legal privileges, and/or  proprietary non-public
information.  If you are not an intended  recipient of this message or an
authorized assistant to an intended  recipient, please notify the sender by
replying to this message and  then delete it from your system.  Use,
dissemination, distribution,  or reproduction of this message and/or any of
its attachments (if  any) by unintended recipients is not authorized and
may be unlawful.


Mime
View raw message