logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oritne <ori...@gmail.com>
Subject Problem regarding LoggerManager
Date Mon, 07 Jun 2010 14:10:12 GMT


I really need help on this issue. I've looked for a solution everywhere but
haven't found one.
Here is my problem:

In the company I work for, A log4net wrapper is being used in order to write
logs into files (and database). The problem is, that when I try to write
details as line number and file name into the log file, I get question
marks, and it happens IN DEBUG MODE, where I have a pdb file.

I've done some testing and found out that it happens only when I use
LoggerManager object. If I use LogManager object it works just fine.

Here is how I use it:

The Log.config:

<logger name="CodeExamples.Program">
      <level value="DEBUG"/>
      <appender-ref ref="Global" />     

<appender name="Global" type="log4net.Appender.RollingFileAppender">      
      <layout type="log4net.Layout.PatternLayout">

This piece of code prints out the question marks:
private ILogger logger;
logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(),
logger.Log(MethodBaseType, Level.Error, Message, null);

Here is its output:
[07 06 2010 16:11:09,343] ERROR: Attempted to divide by zero.; Logger:
CodeExamples.Program; File: ?; Line: ?; Type: ?;

This one works just fine:
private ILog log;
log = LogManager.GetLogger(Assembly.GetCallingAssembly(),
log.Error(Message, null); 

and the output:
[07 06 2010 16:11:09,365] ERROR: Attempted to divide by zero.; Logger:
CodeExamples.Program; File: D:\Projects\MyLogger\MyLog.cs; Line: 41; Type:

If I could, I would use only LogManager, but the wrapper I work with uses
the LoggerManager, and touching it is the last thing I want to do...

Any help will be appreciated!

View this message in context: http://old.nabble.com/Problem-regarding-LoggerManager-tp28805753p28805753.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

View raw message