I am using log4net to log the errors.
Currently I downloaded the file log4net.dll
, then made the following change in global.asax
file:
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected void Application_Start(object sender, EventArgs e)
{
log4net.Config.XmlConfigurator.Configure();
}
protected void Application_Error(object sender, EventArgs e)
{
Log.Fatal("An uncaught exception occurred", this.Server.GetLastError());
}
also these changes were made in the web.config file
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="c:\Log4NetExample.log"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/>
</layout>
</appender>
<root>
<level value="All"/>
<appender-ref ref="LogFileAppender"/>
</root>
everything works.. but what I need is to move the code from the web.config
and read it from a text file instead.
Also I need 2 levels of debug and error..
Can anyone help me with this?
Thank you