Why are my exceptions not being logged with ServiceStack NLog? -



Why are my exceptions not being logged with ServiceStack NLog? -

given nlog config file:

<extensions> <add assembly="seq.client.nlog"/> </extensions> <variable name="servicename" value="lo.leads.processor"/> <targets async="true"> <target name="seq" xsi:type="seq" serverurl="http://mywebsite"> <property name="threadid" value="${threadid}" as="number" /> <property name="machinename" value="${machinename}" /> </target> <target name="file" xsi:type="file" layout="${longdate}|${logger}|${level}|${threadid}|${message}" filename="c:\logfiles\leads\processor\processor.log" archivefilename="c:\logfiles\leads\processor\processor.{##}.log" archiveevery="day" archivenumbering="rolling" maxarchivefiles="45" concurrentwrites="true"/> <target name="debugger" xsi:type="debugger" layout="${logger}:${message}"/> <target name="console" xsi:type="console" layout="${logger}:${level}:${threadid}:${message}" /> </targets> <rules> <logger name="*" minlevel="info" writeto="seq" /> <logger name="*" minlevel="error" writeto="file" /> <logger name="*" minlevel="debug" writeto="debugger" /> <logger name="*" minlevel="debug" writeto="console" /> </rules>

and code block:

public class programme { static program() { logmanager.logfactory = new nlogfactory(); } public static void main() { hostfactory.run(x => { x.service<processorapphost>(s => { s.constructusing(name => new processorapphost()); s.whenstarted(ah => { ah.init(); ah.start("http://*:8088/"); "message processor listening @ http://localhost:8088 ".print(); }); s.whenstopped(ah => ah.dispose()); }); x.runaslocalsystem(); x.setdescription("processes messages leads application."); x.setdisplayname("leads message processor"); x.setservicename("loleadsprocessor"); }); } } //mqhandlers mqserver.registerhandler<leadinformation>(m => { seek { var db = container.resolve<ifrontendrepository>(); db.savemessage(m message); } grab (exception exception) { _log.error("this text logged", exception); } homecoming servicecontroller.executemessage(m); });

and exception

and here output 'file' logger

2014-11-11 10:06:53.9179|processorapphost|error|24|this text logged

any thought how overloaded version of error work correctly?

thank you, stephen

${message} contains message of exception, "this text logged".

take @ exception layout renderer.

layout="${longdate}|${logger}|${level}|${threadid}|${message}|${exception}"

servicestack nlog

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -