akkadotnet / Akka.Logger.log4net

Akka.NET logging integration for Log4Net library
Apache License 2.0
4 stars 7 forks source link

Log messages always have this "? lambda_method" text as part of the message #23

Open jonnydee opened 3 months ago

jonnydee commented 3 months ago

Version Information Version of Akka.NET? 1.4.51 Which Akka.NET Modules? Akka.Logger.log4net version 1.3.1

Describe the bug We are using log4net and the corresponding Akka.Logger.log4net integration. The log messages originating from Akka.NET as well as from our own actors (which are using the ILoggingAdapter returned by Context.GetLogger() method) always have this ? lambda_method text as part of the message:

2024-03-26 12:02:06,863 [11] INFO ? lambda_method - Starting remoting

Note that log messages not originating from Akka.NET related components don't look like this:

024-03-26 12:02:09,575 [ServiceThread] INFO Some.Class.Name SomeMethodName - Some log message

Our log4net logger configuration section which configures the "layout" of log messages looks like this:

<appender name=...>
  <layout type="log4net.Layout.PatternLayout">
    <!-- %d = date, %t = thread, %p = property, %C = type, %M = method, %m = message, %n = newline -->
    <param name="ConversionPattern" value="%d [%t] %p %C %M - %m%n"/>
  </layout>
</appender>

To Reproduce Steps to reproduce the behavior:

  1. Configure the log4net logger for Akka.
    akka.loggers = ["Akka.Logger.log4net.Log4NetLogger, Akka.Logger.log4net"]
  2. Use a log4net appender configuration which contains a <layout ...> section as shown above.
  3. Let an actor log some message.

Expected behavior We shouldn't see this ? lambda_method part in the log message.

Actual behavior This is how log messages Akka.NET itself logs look like:

2024-03-27 14:07:45,121 [69] INFO ? lambda_method - Starting remoting
2024-03-27 14:07:45,396 [72] INFO ? lambda_method - Remoting started; listening on addresses : [akka.ssl.tcp://MyActorSystem@localhost:1234]
2024-03-27 14:07:45,398 [11] INFO ? lambda_method - Remoting now listens on addresses: [akka.ssl.tcp://MyActorSystem@localhost:1234]
2024-03-27 14:07:45,438 [12] INFO ? lambda_method - Cluster Node [akka.ssl.tcp://MyActorSystem@localhost:1234] - Starting up...
2024-03-27 14:07:45,478 [69] INFO ? lambda_method - Cluster Node [akka.ssl.tcp://MyActorSystem@localhost:1234] - Started up successfully

Environment Windows 10 22H2 .NET Framework 4.8

Additional context In the Discord channel akkadotnet-help "Dopare" mentioned that:

[...] that library is not using LogEvent's LogSource property at all

Aaronontheweb commented 1 week ago

Is this still a problem @jonnydee ?

jonnydee commented 1 week ago

@Aaronontheweb Unfortunately, it is. There is still this ? lambda_method part in the log output.

Aaronontheweb commented 1 week ago

Has to be an issue with the formatter IMHO

jonnydee commented 1 week ago

I am currently working on a fix for this bug. In my repository clone the implementation seems to work. I still need to do more tests and I am considering to write some unit tests, too.