<?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/"
	>

<channel>
	<title>The Code Dump &#187; techie</title>
	<atom:link href="http://www.codelord.net/category/techie/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codelord.net</link>
	<description>A place a coder rants at...</description>
	<lastBuildDate>Fri, 27 Aug 2010 17:14:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Logging with a Context: Users in Logback and Spring Security</title>
		<link>http://www.codelord.net/2010/08/27/logging-with-a-context-users-in-logback-and-spring-security/</link>
		<comments>http://www.codelord.net/2010/08/27/logging-with-a-context-users-in-logback-and-spring-security/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:14:17 +0000</pubDate>
		<dc:creator>abyx</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[techie]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=214</guid>
		<description><![CDATA[During this hectic time of starting an amazing adventure we find that along many of the big and important challenges we have there is an endless stream of small technical problems that solving poorly means a lot of time will go to waste. One of these is proper logging in a way that will allow [...]]]></description>
			<content:encoded><![CDATA[<div>During this hectic time of starting an amazing adventure we find that along many of the big and important challenges we have there is an endless stream of small technical problems that solving poorly means a lot of time will go to waste.</div>
<div></div>
<div>One of these is proper logging in a way that will allow you see what your users are doing properly. Pretty quickly we came to the conclusion we want each log message to contain information about the user&#8217;s context, so we could easily understand what went wrong when a user tells us about it, and be able to track usage patterns.</div>
<div></div>
<div>The simplest thing we thought of was creating our own logger wrapper to insert our special values, but didn&#8217;t like the idea of having to write our own logging interface all over again. We&#8217;re using Logback and Spring Security, and after some googling and stackoverflowing I&#8217;ve found this solution:</div>
<div></div>
<div>We create simple Converters to insert the username and session ID to the logs, if present:</div>
<p><script src="http://gist.github.com/553724.js"> </script></p>
<p>To make logback know where to find these converters, we add this little guy:<br />
<script src="http://gist.github.com/553731.js"> </script></p>
<p>And now all that&#8217;s left are configuration changes. Make your pattern contain our cool new keys (&#8220;%user&#8221; and &#8220;%session&#8221;):<br />
<script src="http://gist.github.com/553738.js"> </script></p>
<p>And this last part is needed for the session context thingie to work (as I was instructed on <a href="http://stackoverflow.com/questions/3542026/retrieving-session-id-with-spring-security">Stack Overflow</a>). We need to add a certain listener to our web.xml:<br />
<script src="http://gist.github.com/553742.js"> </script></p>
<p>And that&#8217;s about it. Happy logging!</p>
<ul></ul>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F08%2F27%2Flogging-with-a-context-users-in-logback-and-spring-security%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F08%2F27%2Flogging-with-a-context-users-in-logback-and-spring-security%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/08/27/logging-with-a-context-users-in-logback-and-spring-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nose doesn&#8217;t discover tests on Solaris</title>
		<link>http://www.codelord.net/2010/03/03/nose-doesnt-discover-tests-on-solaris/</link>
		<comments>http://www.codelord.net/2010/03/03/nose-doesnt-discover-tests-on-solaris/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:05:31 +0000</pubDate>
		<dc:creator>abyx</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=138</guid>
		<description><![CDATA[Note: this is a technical post, to help poor souls that google this When using nose on Solaris machines, simply running nosetests without specifying the file names will not work if you are the root user. To fix this, you must either not be root, or pass nose the argument --exe. That&#8217;s it. Gory details: [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note:</strong> this is a technical post, to help poor souls that google this <img src='http://www.codelord.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>When using <em>nose</em> on Solaris machines, simply running <em>nosetests</em> without specifying the file names will not work if you are the root user. To fix this, you must either not be root, or pass <em>nose</em> the argument <code>--exe</code>. That&#8217;s it.</p>
<p>Gory details: by default, <em>nose</em> ignores executable files. Each file it encounters it checks with <em>os.access(test_file, os.X_OK)</em> to see if it&#8217;s executable. Problem is that Solaris&#8217; <em>access</em> function always returns success for root, regardless of actual file permissions. This is discouraged by POSIX, but known behavior.</p>
<p>I hope this saves someone the 3 hours it wasted for me <img src='http://www.codelord.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F03%2F03%2Fnose-doesnt-discover-tests-on-solaris%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F03%2F03%2Fnose-doesnt-discover-tests-on-solaris%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/03/03/nose-doesnt-discover-tests-on-solaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
