Ian Ringrose
Ian Ringrose

Reputation: 51927

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 controlled from the log4net config file, so that there is a single way to control all logging.

Upvotes: 1

Views: 874

Answers (2)

Adrian Zanescu
Adrian Zanescu

Reputation: 8008

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.

Upvotes: 0

fspirit
fspirit

Reputation: 2547

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.

Upvotes: 1

Related Questions