Skip to content

Instantly share code, notes, and snippets.

@Adolfi

Adolfi/nlog.xml Secret

Last active March 1, 2022 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adolfi/3a6252cdc32535cd05be36b01964bed8 to your computer and use it in GitHub Desktop.
Save Adolfi/3a6252cdc32535cd05be36b01964bed8 to your computer and use it in GitHub Desktop.
nlog config for papertrail
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="NLog.Targets.Syslog" />
</extensions>
<targets>
<target name="file" xsi:type="File" layout="${DefaultLayout}" fileName="${baseDir}\..\..\Logs\{ProjectName}.${shortdate}.log" keepFileOpen="false" encoding="utf-8" />
<target name="syslog" type="Syslog">
<messageCreation>
<facility>Local7</facility>
<rfc5424 hostname="{ProjectName}" appName="${logger}" />
</messageCreation>
<messageSend>
<protocol>TCP</protocol>
<tcp>
<server>{Papertrail: Endpoint}</server>
<port>{Papertrail: Port}</port>
<tls>
<enabled>true</enabled>
</tls>
</tcp>
</messageSend>
</target>
</targets>
<rules>
<logger name="{ProjectName}.*" minlevel="Debug" writeTo="file" />
<logger name="*" minLevel="Debug" appendTo="syslog" />
</rules>
</nlog>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment