How do I control WCF logging from a log4net config file?
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 controlle开发者_开发问答d from the log4net config file, so that there is a single way to control all logging.
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.
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.
精彩评论