log4net not logging exceptions to event viewer

Possibly save 1 hour of your time: We use log4net to log errors to event viewer on our application servers.

So for some reason, the event viewer is not showing the log when there is supposed to be a logged error due to exception.

You need to initialize the log4net with the following statement:

log4net.Config.XmlConfigurator.Configure();

In my web.config/app.config, I have the following configuration:

log4net configuration

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s