NLOG没有记录 [英] NLog is not logging

查看:506
本文介绍了NLOG没有记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在用新的NLOG 2.0。
我已经将它设置手动及利用的NuGet在2个不同的平台上的援助:

I am using the new NLog 2.0. I have set it up both manually and with the aid of NuGet on 2 different platforms:

1)上的Visual Web Developer前preSS 2010回到家里。

1) on a Visual Web Developer express 2010 back at home.

2)在办公室的Visual Studio 2010。

2) On a Visual Studio 2010 in office.

在这两种情况下,我只是不能让它记录。

In both cases I just cant get it to log.

我看了所有的选项提出的这里没有运气的。

I have read all of the options suggested here with no luck.

我使用的第一篇教程中非常基本的配置。

I am using the very basic configuration from the first tutorial.

<?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"
  throwExceptions="true">

<targets>
 <target name="logfile" xsi:type="File" fileName="${basedir}/file.txt" />
</targets>

 <rules>
  <logger name="*" minlevel="Info" writeTo="logfile"/>
 </rules>
</nlog>

这是我如何打电话的记录:

And here is how I am calling the logger:

public partial class _Default : System.Web.UI.Page
{
    Logger logger = LogManager.GetCurrentClassLogger();

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        logger.Fatal("Hello Log!");
    }
}

我没有得到任何例外!

I get no exceptions!

难道我做错了什么?在这里
我在想什么。

Am I doing anything wrong here?? What am I missing.

PS

我已经设置了NLog.config为始终复制,所以这不是任何情况下

I have set the NLog.config to "Copy always" so that's not the case either.

推荐答案

我不得不重新启动Visual Studio和它突然开始工作。

I had to restart Visual Studio and it suddenly start working.

,这是需要的时候并没有想到我!

It didn't occur to me that this is needed!

任何方式抱歉...

这篇关于NLOG没有记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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