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
  • 18,869
  • 22
  • 90
  • 106
Revious
  • 7,383
  • 30
  • 94
  • 142

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
  • 126
  • 5