Skip to content

Instantly share code, notes, and snippets.

@algonzalez
Last active August 29, 2015 14:03
Show Gist options
  • Save algonzalez/b915aa48824e10b46a44 to your computer and use it in GitHub Desktop.
Save algonzalez/b915aa48824e10b46a44 to your computer and use it in GitHub Desktop.
NLog.config for ASP.NET MVC app
<?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}/App_Data/logs/Zenjuries.Web.${shortdate}.log"
layout="${date:format=yyyyMMdd-HH\:mm\:ss.ffff}|${aspnet-sessionid}|${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