locked
Unable to view log message in VS Output window using Nlog (MSTest) RRS feed

  • Question

  • Using MSTest and NLogger i was able to write messages to log file but I don't see the messages any more in Output window of VS test explorer. Below is the configuration file i'm using for NLogger. How to resolve?

    <?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"
          xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
          autoReload="true"
          throwExceptions="true"
          internalLogLevel="Trace" internalLogFile="c:\temp\nlog-internal.log">
    
      <variable name="brief" value="${longdate} | ${threadid} | ${level} | ${callsite} | ${message}"/>
    
    
      <targets>
        <target name="logfile" xsi:type="File" fileName="C:\Test.log" layout="${brief}"  />
        <target name="console" xsi:type="Console" />
        <target name="debugger" xsi:type="Debugger" layout="${logger}::${message}"/>
    
      </targets>
    
    
    
      <rules>
        <logger name="*" minlevel="Info" writeTo="logfile" />
        <logger name="*" minlevel="Trace" writeTo="debugger" />
        <logger name="*" minlevel="Info" writeTo="console" />
     </rules>
    </nlog>

    • Edited by raj2379 Tuesday, November 1, 2016 6:01 PM
    Tuesday, November 1, 2016 6:01 PM

All replies

  • I encountered the same issue. Used to see messages before, but suddenly no longer.

    After some investigation, I managed to resolve it by marking attribute "detectConsoleAvailable" in the console target line of the NLog config file to false.

    This attribute was introduced in NLog build 4.3.10 and set to true by default.

    Once I adjusted the console target config file to look like below, messages re-appeared again.

    <target name="console" xsi:type="Console" detectConsoleAvailable="false" />


    Thursday, November 3, 2016 8:24 AM