Nlog Config from myApp xml config file -


i want use nlog in c# app, wants nlog config in app config under specified node(eventlog).

<myconfig>   <eventlog>     <nlog xmlns="http://www.nlog-project.org/schemas/nlog.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" >       <targets>         <target name="console" xsi:type="coloredconsole" layout="${date:format=hh\:mm\:ss}|${level}|${stacktrace}|${message}|${exception:format=tostring:separator=#13#10}" />       </targets>       <rules>         <logger name="*" minlevel="trace" writeto="console" />       </rules>     </nlog>   </eventlog> </myconfig> 

how it?

xdocument doc = xdocument.load("myappconfig.xml"); xelement myconfignode = doc.element("myconfig"); xelement eventlognode = myconfignode.element("eventlog");  nlog.logmanager.configuration =        new nlog.config.xmlloggingconfiguration(eventlognode.createreader(), null);   

not work?!!


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -