logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vivek R. Rathod" <vrat...@appsecinc.com>
Subject RE: Using an Appender as a Template
Date Wed, 28 Jul 2010 18:42:27 GMT
Yes, but this requires you to have a live logger defined in the config file as  opposed to
just having an Appender defined. And, in case you are working with the  RollingFileAppender,
when log4net loads the logger, it will touch the file you specify, which you may not want.
From: Rob Richardson [Rob.Richardson@rad-con.com]
Sent: Wednesday, July 28, 2010 2:08 PM
To: Log4NET User
Subject: RE: Using an Appender as a Template

Couldn't you have a sample logger defined in your config file, open that
in code, and then copy its settings into your dynamically created

log4net.Repository.Hierarchy.Logger l =
LogManager.GetLogger(projectName).Logger as
log4net.Appender.RollingFileAppender appender = new

Log4net.Repository.Hierarchy.Logger sample =
appender.AppendToFile = sample.Appender["SampleAppender"].AppendToFile;

RobR, probably showing his ignorance

View raw message