can't start Trace in Nlog

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

can't start Trace in Nlog

gaav
try the simplest code in VS 2010
 
using NLog;

namespace Myprogram
{
    static class Program
    {
         private static Logger logger = LogManager.GetLogger("Program");
        [STAThread]
        static void Main()
        {
            logger.Trace("Sample trace message");  
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new TestForm());
        }
    }
}


<?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="file" xsi:type="File" fileName="${basedir}/log.txt" />
    </targets>

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

the File is created. I have the message "Sample trace message", but I don't have any Trace.

When Debug I receive:

Environment Variables:Retrieving "NLOG_INTERNAL_LOG_TO_CONSOLE"
Retrieving the value of the environment variable "NLOG_INTERNAL_LOG_TO_CONSOLE".

Environment Variables:Evaluated to "null"
The value of the environment variable was "null".
Environment Variables:Retrieving "NLOG_INTERNAL_LOG_TO_CONSOLE_ERROR"
Retrieving the value of the environment variable "NLOG_INTERNAL_LOG_TO_CONSOLE_ERROR".
Environment Variables:Evaluated to "null"
The value of the environment variable was "null".
Environment Variables:Retrieving "NLOG_INTERNAL_LOG_LEVEL"
Retrieving the value of the environment variable "NLOG_INTERNAL_LOG_LEVEL".
Environment Variables:Evaluated to "null"
The value of the environment variable was "null".
Environment Variables:Retrieving "NLOG_INTERNAL_LOG_FILE"
Retrieving the value of the environment variable "NLOG_INTERNAL_LOG_FILE".
Environment Variables:Evaluated to "null"
The value of the environment variable was "null".


What is wrong?