You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Ron Grabowski <ro...@yahoo.com> on 2005/07/01 04:01:52 UTC
Re: XmlConfigurator or DOMConfigurator
You only need one of those. I usually do this:
protected void Application_Start(Object sender, EventArgs e)
{
log4net.Config.XmlConfigurator.ConfigureAndWatch(
new System.IO.FileInfo(
AppDomain.CurrentDomain.SetupInformation.ApplicationBase +
"log4net.config"));
log.Info("Application started");
}
protected void Application_End(Object sender, EventArgs e)
{
log.Info("Application ended");
log4net.LogManager.Shutdown();
}
My log4net.config file is located in the same folder as web.config.
What happens when you turn on log4net's internal debug log in your
web.config?
<appSettings>
<add key="log4net.Internal.Debug" value="true" />
</appSettings>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="log4netInternalDebugListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\writeable_directory\\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
--- Weston Weems <ww...@gmail.com> wrote:
> I went from a DOMConfigurator and settings in my webconfig, however
> I'd like to pull that logging into its own config file. I decided
> that
> since domconfigurator was deprecated, or obsolete etc, that I was
> going to use XmlConfigurator.
>
> Anyway I've currently got Log4Net.config, and changed my assembly
> info to read:
> [assembly: log4net.Config.XmlConfigurator(
> ConfigFile="Log4Net.config",Watch=true )]
>
> and my global.asax has:
> log4net.Config.XmlConfigurator.Configure(); in the application start.
>
> I havent seen any writing to my logs since I changed that stuff over.
> Am I doing something wrong?