Can anyone please help with programmatic configuration of NLog internal logger?
I have various targets and the email target is not sending any email, although it does h
Soms examples:
// enable internal logging to the console
NLog.Common.InternalLogger.LogToConsole = true;
// enable internal logging to a file
NLog.Common.InternalLogger.LogFile = "c:\\log.txt";
// enable internal logging to a custom TextWriter
NLog.Common.InternalLogger.LogWriter = new StringWriter(); //e.g. TextWriter writer = File.CreateText("C:\\perl.txt")
// set internal log level
NLog.Common.InternalLogger.LogLevel = LogLevel.Trace;
See the NLog wiki
Internal logging can be configured through code by setting the following properties on InternalLogger class:
- InternalLogger.LogLevel - specifies internal logging level
- InternalLogger.LogFile - specifies name of the log file (null will disable logging to a file)
- InternalLogger.LogToConsole - enables or disables logging to the console
- InternalLogger.LogToConsoleError - enables or disables logging to the console error stream
- InternalLogger.LogToTrace - enables or disables logging to System.Diagnostics.Trace (introduced in NLog 4.3)
- InternalLogger.LogWriter - specifies a TextWriter object to use for logging
- InternalLogger.IncludeTimestamp - enables or disables whether timestamps should be included in the internal log output (NLog 4.3+)