Giter Site home page Giter Site logo

nlog.elmah's Introduction

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.

nlog.elmah's People

Contributors

304notmodified avatar jtone123 avatar kichristensen avatar snakefoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlog.elmah's Issues

Can't set Elmah Source.

Per title, I'd like to be able to have the source written to the Elmah table. At the moment, when using this very handy utility, the source column is blank.

I know Elmah uses ApplicationName in it's settings, but Source is useful for defining different sub systems of a larger app.

(apologies if there is a way to do this, but I can't see it in the docs!)

How do you use this library?

Hi. Love this library. But beyond the name, I have not a clue how to use it in my project. Does this take calls to NLog and send them to ELMAH? How do you use it? Just a few sentences would help me tremendously.

I have an ASP.NET MVC app that has NLog and I'd like to add ELMAH, so that all existing NLog calls get sent to ELMAH. Thanks.

Apply Elmah target to all controllers

Hi @304NotModified. Is it possible to apply the [Target("Elmah")] attribute to all controllers? I was thinking of adding it via FilterConfig.cs as a global filter:

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
	filters.Add(new HandleErrorAttribute());
	filters.Add(new ElmahTarget());
}

It errored out on the above with this message:

The given filter instance must implement one or more of the following filter interfaces: System.Web.Mvc.IAuthorizationFilter, System.Web.Mvc.IActionFilter, System.Web.Mvc.IResultFilter, System.Web.Mvc.IExceptionFilter, System.Web.Mvc.Filters.IAuthenticationFilter.

Other than to add the attribute to a base controller/class, is it possible to have it applied globally? This would send all NLog log information to Elmah as well for the entire app. Thanks

.NET Core support?

Does this support .net core?

Can you provide a sample showing it working under asp.net core?

Thanks.

Build fails due to licenseUrl and PackageIcon

C:\Program Files\dotnet\sdk\5.0.301\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): error NU5125: The 'licenseUrl' element will be deprecated. Consider using the 'license' element instead. [C:\projects\nlog\NLog.Elmah\NLog.Elmah.csproj]
C:\Program Files\dotnet\sdk\5.0.301\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): error NU5048: The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.