NLog无法登录简单应用程序 [英] NLog not Logging in Simple App

查看:120
本文介绍了NLog无法登录简单应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码使用Nlog 1.0实现一个简单的日志

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

  Dim _logger = LogManager.GetCurrentClassLogger()
  _logger.Debug("Iain")

以及以下NLog.config.

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?

欢呼

伊恩

推荐答案

未将minLevel设置为记录调试消息.

The minLevel is not set to log Debug messages.

NLog级别为:

  • 致命
  • 错误
  • 警告
  • 信息
  • 调试
  • 踪迹

将minLevel设置为Info时,它将仅记录Info或更高版本;调试和跟踪消息将不会被记录.

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

这篇关于NLog无法登录简单应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆