title: Coordinated logging in a SharePoint farm
body: <p>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.</p>
  
  <p>This questions has been helpful: <a href="https://stackoverflow.com/questions/219668/sharepoint-and-log4net">SharePoint and Log4Net</a>.</p>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <p>Update: We have implemented Log4Net and it works to a point.  The security model of SharePoint makes configuring the necessary permissions more difficult.  In our case we saw that messages would not make it to the log file in certain cases. We used the logging code in a web service that runs as a given account.  When we let it run as a dev, e.g. 'us\bob' and that dev uses a page that calls the web service, then the messages make it to the log file.  Another unresolved issue is how to take into account the permissions needed for writing to a log directory used by the system, i.e. IIS logs or SharePoint logs.</p>