How to configure log4net on SharePoint?

Recently I had to add logging feature to the SharePoint project I’ve been developing. I had to use log4net. I followed my friend’s advice but for some reason it wouldn’t work in my case. I didn’t get any errors or exceptions. Simply nothing was logged to the file, which by the way would not be even created. All in all it looked like a problem with applying the configuration from log4net.config. Indeed, when I looked at the logger object if it’s been configured (log.Logger.Repository.Configured) and it said false.

It turned out the log4net.config was deployed in a wrong location. Apparently, it should be placed there: C:\Inetpub\wwwroot\wss\VirtualDirectories\80.

 How to configure log4net on SharePoint?

1 Response to “How to configure log4net on SharePoint?”

  • Thank you for the sensible critique. Me & my neighbour were preparing to do some research about that. We got a good book on that matter from our local library and most books where not as influensive as your information.

Leave a Reply