views:

254

answers:

2

We do all our logging with log4net, our support staff etc know how to edit the log4net config files. We are now making use of WCF in our apps.

Therefore how can I enable the WCF built in logging to be controlled from the log4net config file, so that there is a single way to control all logging.

A: 

I suggest to implement IParameterInspector and/or IDispatchMessageInspector, and use log4net classes inside that implementations. In this case you'll stick to log4net and it it's not hard (via attributes) to enable logging on your services.

fspirit
A: 

the naive approach will be to have a default configuration for WCF in app.config which you can override from code on application startup with values taken from log4net using System.Configuration classes.

AZ