Skip to content

Instantly share code, notes, and snippets.

@taylorc
Created May 12, 2013 11:43
Show Gist options
  • Select an option

  • Save taylorc/5563274 to your computer and use it in GitHub Desktop.

Select an option

Save taylorc/5563274 to your computer and use it in GitHub Desktop.
Debug form onload event
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
XmlConfigurator.Configure();
serviceRun.Start();
appender = new CustomMemoryAppender();
//Get the logger repository hierarchy.
var logRepository = (Hierarchy)LogManager.GetRepository();
//and add the appender to the root level
//of the logging hierarchy
logRepository.Root.AddAppender(appender);
//configure the logging at the root.
logRepository.Root.Level = Level.All;
//mark repository as configured and
//notify that is has changed.
logRepository.Configured = true;
logRepository.RaiseConfigurationChanged(EventArgs.Empty);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment