EDN Admin
Well-known member
Dear all,
I have below code and config file as below. But I dont find the log file in the folder. Do you know why??
log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));<br/>
ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);<br/>
logger.Info("");<br/>
logger.Info("");<br/>
logger.Info("");<br/>
logger.Info("log4net started...");<br/>
logger.Info("/******** Starting Admin Server ********/");
<?xml version="1.0" encoding="utf-8" ?>
<!-- .NET application configuration file
The .NET Compact Framework does not support application configuration files,<br/>
but log4net supports using configuration files with similar names and structure,<br/>
to store the log4net configuration.<br/>
-->
<configuration><br/>
<!-- This section contains the log4net configuration settings --><br/>
<log4net>
<!-- Define some output appenders -->
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender <br/>
<file value="log\AdminServer.log" /><br/>
<appendToFile value="true" />
<!--<br/>
<maxSizeRollBackups value="10" /><br/>
<maximumFileSize value="100" /><br/>
--><br/>
<rollingStyle value="Date" /><br/>
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout <br/>
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /><br/>
</layout><br/>
</appender>
<!-- Setup the root category, add the appenders and set the default level -->
<root><br/>
<level value="DEBUG" /><br/>
<appender-ref ref="RollingLogFileAppender" /><br/>
</root>
</log4net>
</configuration><br/>
View the full article
I have below code and config file as below. But I dont find the log file in the folder. Do you know why??
log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));<br/>
ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);<br/>
logger.Info("");<br/>
logger.Info("");<br/>
logger.Info("");<br/>
logger.Info("log4net started...");<br/>
logger.Info("/******** Starting Admin Server ********/");
<?xml version="1.0" encoding="utf-8" ?>
<!-- .NET application configuration file
The .NET Compact Framework does not support application configuration files,<br/>
but log4net supports using configuration files with similar names and structure,<br/>
to store the log4net configuration.<br/>
-->
<configuration><br/>
<!-- This section contains the log4net configuration settings --><br/>
<log4net>
<!-- Define some output appenders -->
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender <br/>
<file value="log\AdminServer.log" /><br/>
<appendToFile value="true" />
<!--<br/>
<maxSizeRollBackups value="10" /><br/>
<maximumFileSize value="100" /><br/>
--><br/>
<rollingStyle value="Date" /><br/>
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout <br/>
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /><br/>
</layout><br/>
</appender>
<!-- Setup the root category, add the appenders and set the default level -->
<root><br/>
<level value="DEBUG" /><br/>
<appender-ref ref="RollingLogFileAppender" /><br/>
</root>
</log4net>
</configuration><br/>
View the full article