Thanks a lot.
In the meantime I changed the object that I work with into LogManager
(instead of LoggingManager) and it works just fine.
Thanks anyway!
Orit.


Ron Grabowski wrote:
> 
> Your wrapper needs to pass its Type into log4net's Log method so the code
> that processes StackTrace information knows to skip over certain frames:
> 
> http://code.google.com/p/mybatisnet/source/browse/tags/cs%20release%201.3/IBatisNet.Common.Logging.Log4Net/Log4NetLogger.cs
> 
> public class MyCompanysWrapperLogger : ILog
> {
> 
>  private readonly static Type _declaringType =
> typeof(MyCompanysWrapperLogger);
>  private ILogger _log4netLogger;
> 
>  internal MyCompanysWrapperLogger(ILog log)
>  {
>   _log4netLogger = log.Logger;
>  }
> 
>  public void Info(object message, Exception e)
>  {
>   _logger.Log(declaringType, log4net.Core.Level.Info, message, e);
>  }
> }
> 
> 
> 
> ----- Original Message ----
> From: oritne <ori...@gmail.com>
> To: log4net-user@logging.apache.org
> Sent: Mon, June 7, 2010 10:10:12 AM
> Subject: Problem regarding LoggerManager
> 
> 
> Hi,
> 
> 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" />    
> </logger>
> 
> <appender name="Global" type="log4net.Appender.RollingFileAppender">      
>             
>       
>       
>       
>             
>       
>     
>       <layout type="log4net.Layout.PatternLayout">
>         
>                 
>         
>       </layout>
>     </appender>
> 
> This piece of code prints out the question marks:
> private ILogger logger;
> log4net.Config.XmlConfigurator.ConfigureAndWatch(new
> FileInfo("D:\\Projects\\CodeExamples\\bin\\Debug\\Log.config"));
> logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(),
> MethodBaseType.FullName);
> 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;
> log4net.Config.XmlConfigurator.ConfigureAndWatch(new
> FileInfo("D:\\Projects\\CodeExamples\\bin\\Debug\\Log.config"));
> log = LogManager.GetLogger(Assembly.GetCallingAssembly(),
> MethodBaseType.FullName);
> 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:
> MyLogger.MyLog;
> 
> 
> 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!
> 
> Thanks.
> -- 
> 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 this message in context: 
http://old.nabble.com/Problem-regarding-LoggerManager-tp28805753p28869549.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to