Re: [topshelf-discuss] using NLogLogger with topshelf

956 views
Skip to first unread message

Mario Pareja

unread,
Aug 21, 2012, 8:38:22 AM8/21/12
to topshelf...@googlegroups.com
Martin,

The first step is to add a reference to Topshelf.NLogIntegration in your project. I believe there is a nuget package for this. Now, when you're configuring your host, you should be able to enable NLog based logging with something along these lines:

HostFactory.Run(x => {
  ....
  x.UseNLog();
});

For debugging topshelf issues, I usually include something like this in my NLog.config:

<targets>
...
<target name="console" xsi:type="Console"
layout="${level:uppercase=true}: ${message} | ${exception:format=tostring}"
/>
</targets>
<rules>
...
<logger name="Topshelf.*" minlevel="Info" writeTo="console" />
</rules>

I hope this helps,


Mario Pareja


On Tue, Aug 21, 2012 at 5:01 AM, Martin H. Andersen <martinherl...@gmail.com> wrote:
If some one is having a log file for nlog I can use as a starting point for logging with topshelf I would be very happy.

Reply all
Reply to author
Forward
0 new messages