How to output to the visual studio 2008 'output' window?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to output to the visual studio 2008 'output' window?

Peeks-2
Hi folks,
   i'm trying to set the output to the visual studio 2008 output window. This is the target window when you do the following in code

System.Diagnostics.WriteLine("blah");

I have the following config.
<?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="console" xsi:type="Console" layout="${date:format=HH\:mm\:ss}|${level}|${stacktrace}|${message}" />
    <target name="file" xsi:type="File" fileName="${basedir}/Logs/LolBubs_Errors.log" layout="${date}: ${message}" />
    <target name="eventlog" xsi:type="EventLog" source="NLog" log="Application" layout="${date}: ${message} ${stacktrace}" />
  </targets>
  <rules>
   
    <logger name="*" minlevel="Info" writeTo="console" />
  </rules>
</nlog>

if i set the writeTo to be console .. nothing is outputted.
if i set the writeTo to be file ... it works 100%

this is for asp.net web applications/sites.

can anyone confirm if it's possible and if so, what i'm doing wrong?

i'm also calling the logger.Info("message") method.

cheers!
Reply | Threaded
Open this post in threaded view
|

Re: How to output to the visual studio 2008 'output' window?

Jarek Kowalski
Administrator
Have you tried Debugger target?

http://www.nlog-project.org/target.Debugger.html
NLog Blog
Reply | Threaded
Open this post in threaded view
|

Re: How to output to the visual studio 2008 'output' window?

Peeks-2
Nope - i didn't think it would make a difference.

and if the Debugger target works.... why wouldn't the other targets not work then?
Reply | Threaded
Open this post in threaded view
|

Re: How to output to the visual studio 2008 'output' window?

pmg76
Hi,

Have the same issue with Visual Studio 2010 running Windows Phone 7 (Silverlight).
My config file look like this:

<?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="dbgr" xsi:type="Debugger" layout="${message}"/>
  </targets>

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

I'm logging a button click with the following statements.

            System.Diagnostics.Debug.WriteLine("Test Debug WriteLine");
            _logger.Debug("Pressed button");

The first statements works fine (message is "Output" window can be seen)
The second doesn't work (other targets do work, like MessageBox)

Regards,

Marcos

PD: Not sure if I should have started a new thread or not.