views:

52

answers:

1

We are deploying web parts to SharePoint 2007 and would like to include logging (log4net). The ideal solution would be to use a database appender to avoid the problems with knowing which actual server is executing the web part.

This questions has been helpful: http://stackoverflow.com/questions/219668/sharepoint-and-log4net.

I've got log4net working in a stand-alone web app using Visual Studio dev server using the web.config for the log4net settings and a file appender for the output. I'd like to transition to SharePoint and still use the log file output so I can make sure it's all working first, then change the config around to log to a database.

Is this going to be too much trouble? How have other developers added log4.net into their solutions for SharePoint? Is using a database the only good solution to correlating log output to a server?

+1  A: 

Switching the configuration to use a database appender is certainly easy. You will need to decide how you want to connect to the database: Integrated Authentication vs. SQL Server Login, but both is easy to configure.

I recommend to deploy log4net as a separate solution since Sharepoint does not track dependencies on assemblies. The same applies for other "core" assemblies that your solutions are going to use. Have a look at this question here.

Stefan Egli