logo       

RE: need sample: msg#00098

log.log4net.user

Subject: RE: need sample

To configure log4net you have several options, more details here:
http://logging.apache.org/log4net/release/manual/configuration.html

If you need to programmatically configure appenders have a look at:
http://marc.theaimsgroup.com/?l=log4net-user&m=110890793105314&w=2

To load config from a file use either:

1) Use an assembly attribute to load a config file:

[assembly: log4net.Config.DOMConfigurator]


2) Programmatically load a config file using the following code:

log4net.Config.DOMConfigurator.Configure(FileInfo)

Nicko


> -----Original Message-----
> From: Rutledge, J. Mike [mailto:RUTLEDJ@xxxxxxxx]
> Sent: 25 February 2005 15:00
> To: log4net-user@xxxxxxxxxxxxxxxxxx
> Subject: need sample
>
> Can anyone point me to some sample c# code on how to set up
> the logger and fileappender?
> I've tried following the examples in the supplied
> documentation but I don't understand it all.
>
> For example,
>
> ILog log = LogManager.GetLogger(typeof(Form1));
> FileAppender fa = new FileAppender("c:\\znewlog.txt");
>
> This fails because fileappender constructor is looking for
> another parameter of type ILayout. I can't find any example
> of what Ilayout is or how to pass it in.
>
> Also, If I decide to use a config file to do this, how do you
> link the logger to the config file (make it look there for
> it's settings)?
>
>
> Thanks,
> Rut
>
> ________________________________
>
> 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.
>
>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise