.net - WCF logging: Why isn't Close being called for TraceListener? -


i'm trying log messages wcf service @ transport level. i've followed instructions found on net successfully, want implement own trace listener supports our in-house logging solution.

i've implemented trace listener , configure using app.config of windows service hosting wcf service. following xml use configure logging.

<system.diagnostics>   <sources>     <source name="system.servicemodel.messagelogging">       <listeners>         <add name="messages" type="my.namespace.advancedlogtracelistener, tools.logging, version=2.0.3.1, culture=neutral" initializedata="c:\logs" />       </listeners>     </source>   </sources> </system.diagnostics>  ...  <diagnostics>   <messagelogging logentiremessage="true" logmalformedmessages="false" logmessagesatservicelevel="false" logmessagesattransportlevel="true">   </messagelogging> </diagnostics> 

all of works pretty well. however: our in-house logging solution used class. class starts background thread perform actions log-cleaning, actual logging asynchronously, etc. class requires method named close called when closing application, stops internal processing , exits thread.

the tracelistener class, tracelistener inherits from, implements close method. i've overridden method follows:

public override void close() {    base.close();    this.logfile.close(); } 

only doesn't work. close method of tracelistener not seem called. should ensure can call close method when application hosting wcf service closed?

nevers mind, found solution implementing message inspectors.


Comments