Skip to content

Instantly share code, notes, and snippets.

@ishisaka
Last active December 25, 2015 01:49
Show Gist options
  • Save ishisaka/6897653 to your computer and use it in GitHub Desktop.
Save ishisaka/6897653 to your computer and use it in GitHub Desktop.
NLogでテキストファイルにスタックトレースをそれなりに綺麗に出力する為のNLog.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">
<!--
See http://nlog-project.org/wiki/Configuration_file
for information on customizing logging rules and outputs.
-->
<targets>
<!-- add your targets here -->
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${level:uppercase=true}&#009;[${callsite}] ${message} ${onexception: ${newline} ${exception:format=Message, Type, ToString:separator=*}}"
header="[${longdate}: ${processname} Start.]"
footer="[${longdate}: End.]"/>
</targets>
<rules>
<!-- add your logging rules here -->
<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