Skip to content

Instantly share code, notes, and snippets.

@leighghunt
Created June 20, 2012 23:15
Show Gist options
  • Save leighghunt/2962847 to your computer and use it in GitHub Desktop.
Save leighghunt/2962847 to your computer and use it in GitHub Desktop.
C#: logging log4net log4NetConfigFile
// Add reference to System.Configuration
using System.Configuration;
private void Application_Startup(object sender, StartupEventArgs e)
{
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["log4NetConfigFile"]));
log4net.LogManager.GetLogger(typeof(App)).InfoFormat("Application_Startup()");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment