开发者

NLog not Logging in Simple App

开发者 https://www.devze.com 2023-01-20 10:31 出处:网络
I am trying to implement a simple log using Nlog 1.0, using the following code Dim _logger = LogMa开发者_JAVA百科nager.GetCurrentClassLogger()

I am trying to implement a simple log using Nlog 1.0, using the following code

  Dim _logger = LogMa开发者_JAVA百科nager.GetCurrentClassLogger()
  _logger.Debug("Iain")

And the following NLog.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="file" xsi:type="File" fileName="${basedir}/Site.log" layout="${date}: ${message}"/>
    <target name="eventlog" xsi:type="EventLog" source="My App" log="Application" layout="${date}: ${message} ${stacktrace}"/>
  </targets>
  <rules>
    <logger name="*" minlevel="Info" writeTo="file" />
    <logger name="*" minlevel="Fatal" writeTo="eventlog" />
  </rules>

</nlog>

The app just dosnt seem to be logging, any ideas?

Cheers

Iain


The minLevel is not set to log Debug messages.

NLog levels are:

  • Fatal
  • Error
  • Warn
  • Info
  • Debug
  • Trace

When you have minLevel set to Info, it will only log Info and higher; Debug and Trace messages will not be logged.

0

精彩评论

暂无评论...
验证码 换一张
取 消