Hi;

 

I am writing a J# wrapper around log4net. I am doing this by implementing the public classes in log4j using it’s package/names so my java code is common source between java and J#.

 

I have it working except it uses the file name & line number from my Logger.jsl instead of the app that calls my logger.

 

I can’t inherit from LoggerWrapperImpl because that is a C# class. (Would be cool if you could do that.)

 

So I did the following:

 

public class Logger

{

      private log4net.ILog log;

      private Logger(Class appClass)

      {

            log = log4net.LogManager.GetLogger(Class.ToType(appClass));

      }

      public void error(Object message)

      {

            log.Error(message);

      }

}

 

Which works fine, but has the filename/line number problem. So I then tried:

      public void error(Object message)

      {

            ((log4net.Core.LogImpl)log).get_Logger().Log(type, log4net.Core.Level.Error, "again" + message, null);

      }

 

Which gave the app domain as the filename and 0 as the line number.

 

So…..

 

Any suggestions on what to try next?

 

Thanks – dave

 

Reply via email to