views:

247

answers:

1

I'm thinking about using log4net in a MOSS(SharePoint) 2007 project, but I need to know if the logging can easily be configured to log using a certain username + password.

+3  A: 

Doesn't look like it (based on a quick flick through the documentation), but you could certainly create a wrapper class for Log4Net that uses impersonation to perform the logging as your required user

Impersonation and Delegation in .NET 2.0 (Should be the same techniques for 3.5)

Paul Nearney
I was thinking about creating this wrapper, but it could be quite resource intensive and its a lot of work to implement, from where we are on our current project.
Michael L
Depends on what you've already implemented, but I would see it being fairly straightforward - create a class that has the same methods as the ones you are using in Log4Net - the class is responsible for getting the credentials and passing the calls through to Log4NET, but under the impersonated user
Paul Nearney
You would then need to replace all existing calls to Log4Net to this new class. Can't see any obvious resource issues, but you could e.g. make sure the new class caches the credentials rather than determining them for each call
Paul Nearney
I think you're right..
Michael L