We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Even when eventId is provided, the pattern %property{eventId} will always produce (null) in the logs.
eventId
%property{eventId}
(null)
To reproduce this problem, I modified the following file: samples\Net8.0\WebApi\Controllers\WeatherForecastController.
samples\Net8.0\WebApi\Controllers\WeatherForecastController
// Added the following 2 lines EventId eventId = 1001; _logger.LogWarning(eventId, "Sample with EventId"); _logger.LogCritical(new Exception("ExceptionText"), "This is {weather}", weatherForecasts.First().Summary); _logger.LogTrace("Weather forecast ready!");
This produced the following log entry
2024-03-05 11:11:28,910 WARN Sample.WebApi.Net80.Controllers.WeatherForecastController.Get [(null)] [32] - MESSAGE: Sample with EventId
I would have expected
2024-03-05 11:11:28,910 WARN Sample.WebApi.Net80.Controllers.WeatherForecastController.Get [1001] [32] - MESSAGE: Sample with EventId
Just a reminder that the log4net.config has the following conversion pattern
log4net.config
<layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date %5level %logger.%method [%property{eventId}] [%line] - MESSAGE: %message%newline %exception" /> </layout>
The text was updated successfully, but these errors were encountered:
huorswords
No branches or pull requests
Even when
eventId
is provided, the pattern%property{eventId}
will always produce(null)
in the logs.To reproduce this problem, I modified the following file:
samples\Net8.0\WebApi\Controllers\WeatherForecastController
.This produced the following log entry
I would have expected
Just a reminder that the
log4net.config
has the following conversion patternThe text was updated successfully, but these errors were encountered: