<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>public abstract string[] Blog() &#187; log</title>
	<atom:link href="http://extractmethod.wordpress.com/tag/log/feed/" rel="self" type="application/rss+xml" />
	<link>http://extractmethod.wordpress.com</link>
	<description>Wandering the Internet is search of better code and coding techniques</description>
	<lastBuildDate>Sat, 21 Jun 2008 14:01:14 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='extractmethod.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/aa59efbf3eef34a86e290a03a0aeb4a1?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>public abstract string[] Blog() &#187; log</title>
		<link>http://extractmethod.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://extractmethod.wordpress.com/osd.xml" title="public abstract string[] Blog()" />
		<item>
		<title>Antlr + log4net = ?</title>
		<link>http://extractmethod.wordpress.com/2008/02/14/antlr-log4net/</link>
		<comments>http://extractmethod.wordpress.com/2008/02/14/antlr-log4net/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 06:50:13 +0000</pubDate>
		<dc:creator>casademora</dc:creator>
				<category><![CDATA[ANTLR]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[grammar]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[parse]]></category>

		<guid isPermaLink="false">http://extractmethod.wordpress.com/2008/02/14/antlr-log4net/</guid>
		<description><![CDATA[I&#8217;ve been using log4net in nearly every application I&#8217;ve written for the past couple of years. It has met my needs in every single instance. From logging to a file, to sending emails, to writing to a console, to doing all three at the same time, you can&#8217;t beat log4net (or your own flavor).
I&#8217;ve also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extractmethod.wordpress.com&blog=2356552&post=18&subd=extractmethod&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve been using log4net in nearly every application I&#8217;ve written for the past couple of years. It has met my needs in every single instance. From logging to a file, to sending emails, to writing to a console, to doing all three at the same time, you can&#8217;t beat log4net (or your own flavor).</p>
<p>I&#8217;ve also started to use ANTLR for, what else, parsing some input. I got the hang of parsing input and converting it to an Abstract Syntax Tree without too many issues. However, when it came time to include actions when walking the tree, and finding out the values that are being created or parsed, nothing beats the old printf function. Or rather, WriteLine.  However, in all the ANTLR examples I found, everyone was writing to the Console. I don&#8217;t like writing to the console directly anymore, as I find that there may be a case when I want to pipe that output to the System Event Log (for example). So, I didn&#8217;t think too hard in what needed to come next: a reference to a log4net Logger in the grammar file.</p>
<p>In your grammar file, start with:</p>
<pre>@header{

<span class="kwrd">   using</span> System.Reflection;

<span class="kwrd">   using</span> System.Text;    <span class="kwrd"></span> <span class="kwrd">   using</span> log4net;

}</pre>
<p>Then add a dash of</p>
<pre>@members {

<span class="kwrd">   private</span> <span class="kwrd">readonly</span> <span class="kwrd">static</span> ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); }</pre>
<p>Then, in your actions, you can reference your Log object like so:</p>
<pre>myRule  : methodName <span class="str">'('</span> oneParam <span class="str">')'</span>

{

  Log.Debug(<span class="str">"Who cares where I am, I can send my parse output to log4net!"</span>);

}

;</pre>
<p>Parse with glee now that you can watch the parser do what it does best to your DSLs&#8230;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/extractmethod.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/extractmethod.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extractmethod.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extractmethod.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extractmethod.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extractmethod.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extractmethod.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extractmethod.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extractmethod.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extractmethod.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extractmethod.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extractmethod.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extractmethod.wordpress.com&blog=2356552&post=18&subd=extractmethod&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://extractmethod.wordpress.com/2008/02/14/antlr-log4net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4c5bc935da066bf73113e426f396ba60?s=96&#38;d=identicon" medium="image">
			<media:title type="html">casademora</media:title>
		</media:content>
	</item>
	</channel>
</rss>