c# - How to enable wcf tracing prgrammatically? -


I have a WCF service (project output type-window application) that is hosted as a Windows service. All client and server logic is in the C # code and I do not have any configuration files. I need to enable wcf tracing without using the config file. How can I do this?

You can configure the program that you file your .config If you initialize your service, just add this code (customize it according to your logging requirements):

  var listener = new XmlWriterTraceListener ("Log.xml"); Debug.Listeners.Add (listener);   

Note that you can set all properties (log level, for example), as you would with the attributes in your .config file Do:

  debug Etoflu = true; Listner. TraceOutputation = Traceaptis. call stack;   

You can also add your custom filter:

  listener.filter = new MyCustomTraceFilter ();    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -