How to enable WCF logging from code instead of application configuration file

I communicate between two processes using WCF. By default, this creates very obscure and simple error messages when something goes wrong, which is not very useful.

On http://msdn.microsoft.com/en-us/library/aa702726.aspx I found out how I can enable more verbose logging. Unfortunately, this seems pretty static. I would like to do this and configure it from the code (save 10 "old" files, specify the path where to store the log files when the application starts ...), but so far I have not found worthy examples.

Is it possible to do this from code, and can anyone give any guidance on how and what I need to do?

+6
debugging logging wcf
source share
1 answer

I do not think that's possible". Message logging is based on the static MessageLogger class from the System.ServiceModel.Diagnostics namespace. This class is internal and is initialized (from the configuration file) in the OnBeginOpen private method for ServiceHostBase.

+3
source share

All Articles