3

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) on a Visual Web Developer express 2010 back at home.

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

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

AMember
  • 3,037
  • 2
  • 33
  • 64
  • I've tested it locally and it works for me with your config file and code. Could you provide us with a sample project in which this situation occurs ? – Luzik Nov 14 '11 at 10:37
  • I had to restart Visual Studio and computer in office and it suddenly start working. It didn't occur to me that this is needed! Any way sorry for that... – AMember Nov 14 '11 at 10:59

1 Answers1

0

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

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

Any way sorry for that...

AMember
  • 3,037
  • 2
  • 33
  • 64