Skip to content

NLog/NLog.Elmah

Repository files navigation

NLog.Elmah

Version AppVeyor

ELMAH target for NLog

Extensions to NLog

Usage

Install the library with Nuget

Install-Package NLog.Elmah

Update NLog to the latest version

Update-Package NLog

Read the NLog tutorial

Example 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"
      throwConfigExceptions="true">

    <extensions>
        <add assembly="NLog.Elmah" />
    </extensions>

    <targets>
        <target name="target1" type="Elmah" />
    </targets>

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

Options

  • Layout - Used for rendering the Elmah.Message. Default is ${message}
  • LogType - Layout for rendering the Elmah.Type Field. Default is ${exception:format=Type:whenEmpty=${level}}

    Introduced with NLog.Elmah v4.1 and replaces obsolete LogLevelAsType

  • LogSource - Layout for rendering the Elmah.Source Field. Default is ${exception:format=Source:whenEmpty=${logger}}
  • LogDetail - Layout for rendering the Elmah.Detail Field. Default is ${exception:format=ToString}
  • LogHostName - Layout for rendering the Elmah.HostName Field. Default is ${hostname}
  • LogUser - Layout for rendering the Elmah.User Field. Default is blank.
  • IdentityNameAsUser - Use HttpContext.User as fallback when LogUser gives blank value. Default is false

Notes

Not strong named (SNK) because the dependency isn't strong named.