logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walden H. Leverich" <Wald...@TechSoftInc.com>
Subject RE: Moving log4net config out of App.config
Date Fri, 25 Apr 2008 12:58:20 GMT
How are you "starting" the logging? We use log4net heavily in our apps,
and we always store the config in log4net.config, but we explicitly
start logging with something along the lines of:

string configFile =
Server.MapPath(ConfigurationManager.AppSettings["log4net-config-file"]);
log4net.Config.XmlConfigurator.ConfigureAndWatch(new
System.IO.FileInfo(configFile));

log = log4net.LogManager.GetLogger(
	System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
log.Info("-----------Logging Started------------");
log.Info("Application Started.");
log.InfoFormat("Watching log4net config file '{0}'", configFile); 

-- 
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

-----Original Message-----
From: aus1977 [mailto:aus1977@gmail.com] 
Sent: Wednesday, April 23, 2008 8:48 AM
To: log4net-user@logging.apache.org
Subject: Moving log4net config out of App.config


I need to move log4net configuration from app.config file and i have
tryed
the following :

app.config file :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="Log4NetConfiguration" value="log4net.config" />
  </appSettings>
</configuration>

log4net.config file:
<log4net>
    
    <appender name="Framework.Manager"
type="log4net.Appender.RollingFileAppender">
      <file value="Logs\Gogimon.Framework.Manager.log.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="1" />
      <maximumFileSize value="500KB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date %newline[%thread] %-5level
%logger
[%ndc] &lt;%property{auth}&gt; - %message%newline%newline" />
      </layout>
    </appender>
    
<logger name="Framework.Manager" additivity="false">
      <level value="ALL" />
      <appender-ref ref="Gogimon.Framework.Manager" />
    </logger>
<log4net>

it is doesn't works 

-- 
View this message in context:
http://www.nabble.com/Moving-log4net-config-out-of-App.config-tp16834575
p16834575.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message