Logger. Always same value.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Logger. Always same value.

shapper
Hello,

I have the following:

    protected void Application_Error() {
     
      ILog log = LogManager.GetLogger(this.GetType());
      Exception exception = Server.GetLastError();
      if (log.IsErrorEnabled)
        log.Error(exception.Message, exception);

    } // Application_Error

And on NLog.config one of the layouts is:
<parameter name="@Logger" layout="${logger}" />

And I always get: ASP.global_asax

What is the use of "logger" if it is always the same?

Thank You,
Miguel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logger. Always same value.

Jason LaFlair
Administrator
Looks like your code is within the Global.asax file

So... ILog log = LogManager.GetLogger(this.GetType()); from within that method by your use and configuration it will always be the same and always return your global.asax file.

Unless I"m missing something here.
Loading...