'log4net log message does not contain method name

I am trying to include the method name %method in log messages when using log4net. However, if I look at the log output it only shows a ? where method name should be.

I know in reading the log4net docs that this is only available with System.Diagnostics.StackTrace and this should only be used in development and not release builds.

Trying to make this work in a .NET Core application using the Microsoft.Extensions.Logging.Log4Net.AspNetCore and the call to .AddLog4Net(); in Startup

Here is the conversionPattern for the RollingFileAppender

<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception" />

I have put together a github repository with bare bone example of what I'm trying to get at. If you run the project you see the log file output does not contain method information.

Repository available at log4net-netcore-example

In reviewing various SO articles, I've not found the solution to this yet. I'm assuming I'm missing a configuration or maybe a nuget package required to make this work.

Appreciate any insights anyone can provide.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source