Skip to content

Instantly share code, notes, and snippets.

@algonzalez
Last active August 29, 2015 14:03
Show Gist options
  • Save algonzalez/c81451b6b6b7a501c0ae to your computer and use it in GitHub Desktop.
Save algonzalez/c81451b6b6b7a501c0ae to your computer and use it in GitHub Desktop.
NLog.config for basic file logging
<?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">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!-- add your targets here -->
<target name="logfile" xsi:type="File"
fileName="${basedir}/logs/Zenjuries.Svc.${shortdate}.log"
layout="${date:format=yyyyMMdd-HH\:mm\:ss.ffff}|${uppercase:${level}}|${logger}|${message}${onexception:|${exception:format=type}\:\:${exception:format=message}|${exception:format=stacktrace}}" />
<!--
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<!-- Levels: Trace, Debug, Info, Warn, Error, Fatal -->
<logger name="*" minlevel="Info" writeTo="logfile" />
<!--
<logger name="*" minlevel="Trace" writeTo="f" />
-->
</rules>
</nlog>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment