0

Since it's for debugging purpose only I don't want to edit the app.config and the solution I've found online start by editing it. Is it possible to create a debug logfile only in code with Log4net?

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
Revious
  • 7,816
  • 31
  • 98
  • 147

1 Answers1

1

You can try the following option.

((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root.Level = Level.Debug;
((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).RaiseConfigurationChanged(EventArgs.Empty);

You can find more details here

SMR
  • 136
  • 5