huorswords/Microsoft.Extensions.Logging.Log4Net.AspNetCore

Can I modify the appenders from within `AddLog4Net()`?

paqogomez opened this issue · 2 comments

I am using an AWS Appender that has a property called LogGroup. I want to be able to set this value dynamically, but the property doesnt allow a PatternLayout.
If I try to set this property's value in code before calling AddLog4Net the appender doesnt exist. If I try to set this value in code after calling AddLog4Net it fails with a validation error saying the LogGroup property cannot be null, and if I populate this value and try overwriting it in code, it doesnt appear to work, the value is set.

I would really like to be able to either manually add/setup an appender as an override in AddLog4Net, or be able to access/modify the appender in a similar manner.

Can I access the appenders in a configuration option to set this value dynamically?

Hello @paqogomez ,

  • Could you share a working example of what is happening to you with this appender?
  • Could be this property initialized from the log4net.config file? Why to change it dynamically? Could be a solution to use the BeginScope approach?

Waiting for your answers...

Closing as inactive.