Created
May 12, 2013 11:43
-
-
Save taylorc/5563274 to your computer and use it in GitHub Desktop.
Debug form onload event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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