Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLog plugin: report custom properties like application name #639

Open
ygavrishov opened this issue Jan 12, 2023 · 1 comment
Open

NLog plugin: report custom properties like application name #639

ygavrishov opened this issue Jan 12, 2023 · 1 comment

Comments

@ygavrishov
Copy link

Hi team!
I did not find a very important possibility - to attach custom properties to error reports. The most typical case is to attach the application name. We have multiple applications that report to the same Rollbar project and only stack trace can help to distinguish applications.

@snakefoot
Copy link
Contributor

snakefoot commented Jan 12, 2023

The NLog RollbarTarget inherits from TargetWithContext that support context-capture.

Example:

<?xml version="1.0" encoding="utf-8" ?>
<nlog throwConfigExceptions="true">

  <extensions>
    <add assembly="Rollbar.PlugIns.NLog"/>
  </extensions>

  <targets>
    <target name="logrollbar" type="Rollbar.PlugIns.NLog">
      <contextproperty name="HostName" layout="${machinename}" />
      <contextproperty name="ApplicationName" layout="MySuperApplication" />
      <contextproperty name="ProcessName" layout="${processname}" />
      <contextproperty name="AppDomainName" layout="${appdomain:cached=true:format=\{1\}}" />
    </target>
  </targets>

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

See also: https://github.com/rollbar/Rollbar.NET/tree/master/Samples/Sample.PlugIns.NLog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants