Last updated: 2006-09-18

This website is based on NLog v1.0. Click here to view the documentation for other versions.

How to troubleshoot logging problems

If you have trouble getting NLog to work properly you may want to enable some debugging output to see what may be going wrong. This document describes the available internal debugging features of NLog.

Enabling internal logging

NLOG_INTERNAL_LOG_TO_CONSOLE - if this variable is found in the environment NLog outputs internal logging information to the console using Console.WriteLine.

NLOG_INTERNAL_LOG_FILE - if this variable is found in the environment NLog outputs internal logging information to the specified file. The file must be writable by the current user or it will not be created.

NLOG_INTERNAL_LOG_LEVEL - sets the internal logging level. The available values are Debug, Info, Warn, Error, Fatal - the default is Info which should be appropriate for most cases, to get more detailed logging - set it to Debug.

Enabling internal logging using the environment variables

Enabling internal logging in the interactive processes

This case is easy. Just open the command prompt (cmd.exe), set your variables using the SET command and run your program. Here's the example:

        Microsoft Windows [Version 5.2.3790]
        (C) Copyright 1985-2003 Microsoft Corp.

        C:\MyApp>set NLOG_INTERNAL_LOG_FILE=c:\temp\mylog.txt

        C:\MyApp>set NLOG_INTERNAL_LOG_LEVEL=Debug

        C:\MyApp>myapp.exe
    
Enabling internal logging in the service processes

TO BE WRITTEN

Enabling internal logging programmatically

TO BE WRITTEN

Last updated: 2006-07-10 11:32:55

Webwww.nlog-project.org