logging - Enterprise Library 6 LogCallHandler throwing exception "The LogWriter has not been set for the Logger static class" -
guys
i'm trying using logcallhandler interception this:
<interception> <policy name="policylogcallhandler"> <matchingrule name="logsmachingrule" type="namespacematchingrule"> <constructor> <param name="namespacename" value="nettcpcontracts" /> </constructor> </matchingrule> <callhandler type="microsoft.practices.enterpriselibrary.logging.policyinjection.logcallhandler, microsoft.practices.enterpriselibrary.policyinjection, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" name="callhandlerlog"> <constructor> <param name="eventid" value="9002"/> <param name="logbeforecall" value="true"/> <param name="logaftercall" value="true"/> <param name="beforemessage" value="--- begin"/> <param name="aftermessage" value="--- end"/> <param name="includeparameters" value="true"/> <param name="includecallstack" value="true"/> <param name="includecalltime" value="true"/> <param name="priority" value="1"/> <param name="order" value="1"/> </constructor> </callhandler> </policy> </interception>
this configuration throw exception: "the logwriter has not been set logger static class. set invoking logger.setlogwriter method."
i found solutions problem using runtime configuration:
iconfigurationsource configurationsource = configurationsourcefactory.create(); logwriterfactory logwriterfactory = new logwriterfactory(configurationsource); logger.setlogwriter(logwriterfactory.create()); logentry entry = new logentry(); entry.message = "i logging"; logger.write(entry)
but, i'm using configuration through config file. how reproduce behavior in config file?
tks!
the boostrapping behavior of enterprise library has changed in version 6. impact static logger facade need set internal logwriter (for example @ application start): more details refer https://entlib.codeplex.com/discussions/442089
thanks
Comments
Post a Comment