NLog configuration file root node and nlog configuration file Node
NLog. cnfig configuration file information
<Nlog xmlns = "http://www.nlog-project.org/schemas/NLog.xsd" xmlns: xsi = http://www.w3.org/2001/XMLSchema-instance autoReload = "true" // automatically loaded throwExceptions = "true" // NLog log system throws an exception internalLogFile = "c: \ log \ nlog.txt "// NLog internal log file location internalLogLevel =" Debug "// log Level
> // Declare the variable syntax <variable name = "myvar" value = "myvalue"/>
Value can be used in Layout expressions, such as Layout <variable name = "logDirectory" value = "$ {basedir}/logs/$ {seasonal date}"/>
<Nlog>
AutoReload Automatic reconfiguration)
Once the program is started, after the NLog. config file is read, it is known that the program will not read the configuration file again after it is started. If we don't want to stop the program, for example, how can we say that the server stops. This configuration is used. The configuration function is that once you modify the configuration file, the program will re-read the configuration file, that is, automatically re-configure.
Troubleshooting logging)
<Nlog throwExceptions = "true"/>
<Nlog internalLogFile = "c: \ log \ nlog.txt"/>-Setting the internalLogFile attribute allows NLog to write internal debugging and exception information to the specified file.
<Nlog internalLogLevel = "Trace | Debug | Info | Warn | Error | Fatal"/>-determines the level of internal logs. The higher the level, the simpler the output log information. InternalLogLevel = "Off" Disabled
<Nlog internalLogToConsole = "false | true"/>-whether to output internal logs to the standard console.
<Nlog internalLogToConsoleError = "false | true"/>-whether to output internal logs to the stderr console ).
Setting the throwExceptions attribute to "true" can prevent NLog from blocking such exceptions, but throw them to the caller. This can help us quickly locate problems during deployment. Once the application has been correctly configured, we recommend that you set the throwExceptions value to "false" so that the application will not crash due to log issues.