Question

I'm using NLog to log my stuff. I'm trying to send the output to the console (or colouredconsole) ... which I'm hoping would go to the Visual Studio 'OUTPUT' window for any ASP.NET web site/app/mvc app.

It's not. If I change the target to 'file' then it works for sure.

Can NLog output to the 'output' window for web apps?

Was it helpful?

Solution

You can use this configuration file (nlog.config in the app path):

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <targets>
        <target name="debugger" xsi:type="Debugger" layout="${logger}::${message}"/>
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="debugger" />
  </rules>
</nlog>

-Scott

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top