logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Webb" <webbjt...@gmail.com>
Subject Inconsistency of internal logging and behavior in log4net in ASP.NET MVC (multi-assembly)
Date Thu, 24 May 2012 13:42:16 GMT
I have a multi-assembly ASP.NET MVC application.  I reviewed the recent
posts on a similar topic, but decided that my problem merited a new thread.

 

I am configuring log4net is a separate configuration file and initialize
log4net with this statement:

 

[assembly: log4net.Config.XmlConfigurator(ConfigFile =
"WebApplication.log4net", Watch=true)]

 

I am attempting to log from the web application assembly and from another
assembly in the solution.  I enabled log4net internal logging and received
the following:

 

 

log4net: XmlConfigurator: loading XML configuration

log4net: XmlConfigurator: Configuring Repository
[log4net-default-repository]

log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].

log4net: XmlHierarchyConfigurator: Logger [root] Level string is [ERROR].

log4net: XmlHierarchyConfigurator: Logger [root] level set to
[name="ERROR",value=70000].

log4net: XmlHierarchyConfigurator: Loading Appender [DebugAppender] type:
[log4net.Appender.DebugAppender]

log4net: XmlHierarchyConfigurator: Setting Property [ImmediateFlush] to
Boolean value [True]

log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object
[log4net.Layout.SimpleLayout]

log4net: XmlHierarchyConfigurator: Created Appender [DebugAppender]

log4net: XmlHierarchyConfigurator: Adding appender named [DebugAppender] to
logger [root].

log4net: XmlHierarchyConfigurator: Retrieving an instance of
log4net.Repository.Logger for logger
[WebApplication.Controllers.AppController].

log4net: XmlHierarchyConfigurator: Setting
[WebApplication.Controllers.AppController] additivity to [True].

log4net: XmlHierarchyConfigurator: Logger
[WebApplication.Controllers.AppController] Level string is [DEBUG].

log4net: XmlHierarchyConfigurator: Logger
[WebApplication.Controllers.AppController] level set to
[name="DEBUG",value=30000].

log4net: XmlHierarchyConfigurator: Adding appender named [DebugAppender] to
logger [WebApplication.Controllers.AppController].

log4net: XmlHierarchyConfigurator: Retrieving an instance of
log4net.Repository.Logger for logger
[WebApplication.Domain.Implementation.DomainImpl].

log4net: XmlHierarchyConfigurator: Setting
[WebApplication.Domain.Implementation.DomainImpl] additivity to [True].

log4net: XmlHierarchyConfigurator: Logger
[WebApplication.Domain.Implementation.DomainImpl] Level string is [DEBUG].

log4net: XmlHierarchyConfigurator: Logger
[WebApplication.Domain.Implementation.DomainImpl] level set to
[name="DEBUG",value=30000].

log4net: XmlHierarchyConfigurator: Adding appender named [DebugAppender] to
logger [WebApplication.Domain.Implementation.DomainImpl].

log4net: XmlHierarchyConfigurator: Hierarchy Threshold []

 

I am interested in the logger at
WebApplication.Domain.Implementation.DomainImpl and see that it is set to
debug.  However, when I access the logger in the debugger and print its
state I get this:

 

DomainImpl.log       {Common.Logging.Simple.NoOpLogger} Common.Logging.ILog
{Common.Logging.Simple.NoOpLogger}

[Common.Logging.Simple.NoOpLogger] {Common.Logging.Simple.NoOpLogger}
Common.Logging.Simple.NoOpLogger

IsDebugEnabled       false  bool

IsErrorEnabled       false  bool

IsFatalEnabled       false  bool

IsInfoEnabled false  bool

IsTraceEnabled       false  bool

IsWarnEnabled false  bool

              

 

The only thing that made sense to me was that I was accessing a different
logger in my code than the one that was referenced in the log4net log.
However, I only see two loggers created, one each for my web application and
domain assemblies. I don't see any logger created that has no logging levels
enabled.  I am stumped and welcome any guidance. For example, when should I
get a NoOpLogger?

 

 

 


Mime
View raw message