Permalink
Browse files

Site updated at 2013-07-11 03:24:01 UTC

  • Loading branch information...
1 parent 3183786 commit 46069f65333053a9a7b51d3d5f062e41d6b03eb4 Nick Miller committed Jul 11, 2013
View
@@ -4,7 +4,7 @@
<title><![CDATA[Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -100,13 +100,13 @@
</span><span class='line'> <span class="nt">&lt;/targets&gt;</span>
</span><span class='line'>
</span><span class='line'> <span class="nt">&lt;rules&gt;</span>
-</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">minlevel=</span><span class="s">&quot;Info&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;logfile&quot;</span> <span class="nt">/&gt;</span>
+</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">minLevel=</span><span class="s">&quot;Trace&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;{logfile}&quot;</span> <span class="nt">/&gt;</span>
</span><span class='line'> <span class="nt">&lt;/rules&gt;</span>
</span><span class='line'><span class="nt">&lt;/nlog&gt;</span>
</span></code></pre></td></tr></table></div></figure>
-<p>For exceptions:</p>
+<p>To log as much data as possible about exceptions, including inner exceptions:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -116,13 +116,15 @@
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
+<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='csharp'><span class='line'><span class="k">try</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="c1">// some code which may throw </span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="k">catch</span> <span class="p">(</span><span class="n">MyException</span> <span class="n">ex</span><span class="p">)</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="n">logger</span><span class="p">.</span><span class="n">ErrorException</span><span class="p">(</span><span class="s">&quot;Got exception.&quot;</span><span class="p">,</span> <span class="n">ex</span><span class="p">);</span>
+</span><span class='line'> <span class="k">throw</span> <span class="n">ex</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
@@ -140,9 +142,9 @@
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='xml'><span class='line'><span class="nt">&lt;nlog&gt;</span>
</span><span class='line'> <span class="nt">&lt;targets&gt;</span>
-</span><span class='line'> <span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;f&quot;</span> <span class="na">type=</span><span class="s">&quot;File&quot;</span>
-</span><span class='line'> <span class="na">layout=</span><span class="s">&quot;${longdate} ${message} ${exception:format=tostring}&quot;</span><span class="nt">/&gt;</span>
-</span><span class='line'> <span class="nt">&lt;/targets&gt;</span>
+</span><span class='line'> <span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;f&quot;</span> <span class="na">type=</span><span class="s">&quot;File&quot;</span> <span class="na">layout=</span><span class="s">&quot;${message}${onexception:EXCEPTION OCCURRED\:${exception:format=ToString,stacktrace,message,method:maxInnerExceptionLevel=5:innerFormat=tostring,stacktrace,message,method}}&quot;</span> <span class="nt">/&gt;</span>
+</span><span class='line'><span class="nt">&lt;/targets&gt;</span>
+</span><span class='line'>
</span><span class='line'> <span class="nt">&lt;rules&gt;</span>
</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;f&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'> <span class="nt">&lt;/rules&gt;</span>
@@ -174,13 +174,13 @@ <h1 class="entry-title">Basics of NLog</h1>
</span><span class='line'> <span class="nt">&lt;/targets&gt;</span>
</span><span class='line'>
</span><span class='line'> <span class="nt">&lt;rules&gt;</span>
-</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">minlevel=</span><span class="s">&quot;Info&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;logfile&quot;</span> <span class="nt">/&gt;</span>
+</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">minLevel=</span><span class="s">&quot;Trace&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;{logfile}&quot;</span> <span class="nt">/&gt;</span>
</span><span class='line'> <span class="nt">&lt;/rules&gt;</span>
</span><span class='line'><span class="nt">&lt;/nlog&gt;</span>
</span></code></pre></td></tr></table></div></figure>
-<p>For exceptions:</p>
+<p>To log as much data as possible about exceptions, including inner exceptions:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -190,13 +190,15 @@ <h1 class="entry-title">Basics of NLog</h1>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
+<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='csharp'><span class='line'><span class="k">try</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="c1">// some code which may throw </span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="k">catch</span> <span class="p">(</span><span class="n">MyException</span> <span class="n">ex</span><span class="p">)</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="n">logger</span><span class="p">.</span><span class="n">ErrorException</span><span class="p">(</span><span class="s">&quot;Got exception.&quot;</span><span class="p">,</span> <span class="n">ex</span><span class="p">);</span>
+</span><span class='line'> <span class="k">throw</span> <span class="n">ex</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
@@ -214,9 +216,9 @@ <h1 class="entry-title">Basics of NLog</h1>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='xml'><span class='line'><span class="nt">&lt;nlog&gt;</span>
</span><span class='line'> <span class="nt">&lt;targets&gt;</span>
-</span><span class='line'> <span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;f&quot;</span> <span class="na">type=</span><span class="s">&quot;File&quot;</span>
-</span><span class='line'> <span class="na">layout=</span><span class="s">&quot;${longdate} ${message} ${exception:format=tostring}&quot;</span><span class="nt">/&gt;</span>
-</span><span class='line'> <span class="nt">&lt;/targets&gt;</span>
+</span><span class='line'> <span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;f&quot;</span> <span class="na">type=</span><span class="s">&quot;File&quot;</span> <span class="na">layout=</span><span class="s">&quot;${message}${onexception:EXCEPTION OCCURRED\:${exception:format=ToString,stacktrace,message,method:maxInnerExceptionLevel=5:innerFormat=tostring,stacktrace,message,method}}&quot;</span> <span class="nt">/&gt;</span>
+</span><span class='line'><span class="nt">&lt;/targets&gt;</span>
+</span><span class='line'>
</span><span class='line'> <span class="nt">&lt;rules&gt;</span>
</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;f&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'> <span class="nt">&lt;/rules&gt;</span>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: .NET, | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/-net-/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: .net | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/-net/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: ASP.NET | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/asp-net/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: c#, | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/c-/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: cheat-sheets | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/cheat-sheets/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: exocortex | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/exocortex/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: howto | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/howto/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: lightswitch | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/lightswitch/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: linux | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/linux/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: nlog, | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/nlog-/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -71,14 +71,14 @@ logger.Log(LogLevel.Info, "Sample fatal error message");
&lt;/targets&gt;
&lt;rules&gt;
- &lt;logger name="*" minlevel="Info" writeTo="logfile" /&gt;
+&lt;logger name="*" minLevel="Trace" writeTo="{logfile}" /&gt;
&lt;/rules&gt;
</code></pre>
<p></nlog>
```</p>
-<p>For exceptions:</p>
+<p>To log as much data as possible about exceptions, including inner exceptions:</p>
<p>```csharp
try
@@ -92,21 +92,19 @@ catch (MyException ex)
{</p>
<pre><code>logger.ErrorException("Got exception.", ex);
+throw ex;
</code></pre>
<p>}
```</p>
<p>```xml
<nlog>
- <targets></p>
+ <targets>
+ <target name="f" type="File" layout="${message}${onexception:EXCEPTION OCCURRED\:${exception:format=ToString,stacktrace,message,method:maxInnerExceptionLevel=5:innerFormat=tostring,stacktrace,message,method}}" />
+</targets></p>
-<pre><code>&lt;target name="f" type="File"
- layout="${longdate} ${message} ${exception:format=tostring}"/&gt;
-</code></pre>
-
-<p> </targets>
- <rules></p>
+<p> <rules></p>
<pre><code>&lt;logger name="*" writeTo="f"/&gt;
</code></pre>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: odata, | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/odata-/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: silverlight | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/silverlight/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: underware | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/underware/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: XAML, | Junk I Would Otherwise Forget]]></title>
<link href="nickmiller.com.au/blog/categories/xaml-/atom.xml" rel="self"/>
<link href="nickmiller.com.au/"/>
- <updated>2013-07-11T11:56:02+10:00</updated>
+ <updated>2013-07-11T13:23:53+10:00</updated>
<id>nickmiller.com.au/</id>
<author>
<name><![CDATA[Nick Miller]]></name>
View
@@ -177,13 +177,13 @@ <h1 class="entry-title"><a href="/blog/2013/07/11/nlog/">Basics of NLog</a></h1>
</span><span class='line'> <span class="nt">&lt;/targets&gt;</span>
</span><span class='line'>
</span><span class='line'> <span class="nt">&lt;rules&gt;</span>
-</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">minlevel=</span><span class="s">&quot;Info&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;logfile&quot;</span> <span class="nt">/&gt;</span>
+</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">minLevel=</span><span class="s">&quot;Trace&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;{logfile}&quot;</span> <span class="nt">/&gt;</span>
</span><span class='line'> <span class="nt">&lt;/rules&gt;</span>
</span><span class='line'><span class="nt">&lt;/nlog&gt;</span>
</span></code></pre></td></tr></table></div></figure>
-<p>For exceptions:</p>
+<p>To log as much data as possible about exceptions, including inner exceptions:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -193,13 +193,15 @@ <h1 class="entry-title"><a href="/blog/2013/07/11/nlog/">Basics of NLog</a></h1>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
+<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='csharp'><span class='line'><span class="k">try</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="c1">// some code which may throw </span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="k">catch</span> <span class="p">(</span><span class="n">MyException</span> <span class="n">ex</span><span class="p">)</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="n">logger</span><span class="p">.</span><span class="n">ErrorException</span><span class="p">(</span><span class="s">&quot;Got exception.&quot;</span><span class="p">,</span> <span class="n">ex</span><span class="p">);</span>
+</span><span class='line'> <span class="k">throw</span> <span class="n">ex</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
@@ -217,9 +219,9 @@ <h1 class="entry-title"><a href="/blog/2013/07/11/nlog/">Basics of NLog</a></h1>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='xml'><span class='line'><span class="nt">&lt;nlog&gt;</span>
</span><span class='line'> <span class="nt">&lt;targets&gt;</span>
-</span><span class='line'> <span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;f&quot;</span> <span class="na">type=</span><span class="s">&quot;File&quot;</span>
-</span><span class='line'> <span class="na">layout=</span><span class="s">&quot;${longdate} ${message} ${exception:format=tostring}&quot;</span><span class="nt">/&gt;</span>
-</span><span class='line'> <span class="nt">&lt;/targets&gt;</span>
+</span><span class='line'> <span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;f&quot;</span> <span class="na">type=</span><span class="s">&quot;File&quot;</span> <span class="na">layout=</span><span class="s">&quot;${message}${onexception:EXCEPTION OCCURRED\:${exception:format=ToString,stacktrace,message,method:maxInnerExceptionLevel=5:innerFormat=tostring,stacktrace,message,method}}&quot;</span> <span class="nt">/&gt;</span>
+</span><span class='line'><span class="nt">&lt;/targets&gt;</span>
+</span><span class='line'>
</span><span class='line'> <span class="nt">&lt;rules&gt;</span>
</span><span class='line'> <span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;*&quot;</span> <span class="na">writeTo=</span><span class="s">&quot;f&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'> <span class="nt">&lt;/rules&gt;</span>
View
@@ -332,14 +332,14 @@
</url>
<url>
<loc>nickmiller.com.au/blog/2013/07/11/nlog/</loc>
- <lastmod>2013-07-11T11:55:34+10:00</lastmod>
+ <lastmod>2013-07-11T13:23:39+10:00</lastmod>
</url>
<url>
<loc>nickmiller.com.au/blog/archives/</loc>
- <lastmod>2013-07-11T11:55:34+10:00</lastmod>
+ <lastmod>2013-07-11T13:23:39+10:00</lastmod>
</url>
<url>
<loc>nickmiller.com.au/</loc>
- <lastmod>2013-07-11T11:55:34+10:00</lastmod>
+ <lastmod>2013-07-11T13:23:39+10:00</lastmod>
</url>
</urlset>

0 comments on commit 46069f6

Please sign in to comment.