<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>DanNorris.com - Latest Comments in On handling logging in a script</title><link>http://dannorris.disqus.com/</link><description></description><atom:link href="https://dannorris.disqus.com/on_handling_logging_in_a_script/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 17 Jan 2008 19:55:38 -0000</lastBuildDate><item><title>Re: On handling logging in a script</title><link>http://www.dannorris.com/2008/01/11/on-handling-logging-in-a-script/#comment-1921061</link><description>&lt;p&gt;no kilt no way.  too cold, the boyz will freeze.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">billy</dc:creator><pubDate>Thu, 17 Jan 2008 19:55:38 -0000</pubDate></item><item><title>Re: On handling logging in a script</title><link>http://www.dannorris.com/2008/01/11/on-handling-logging-in-a-script/#comment-1921062</link><description>&lt;p&gt;That's a nice way to handle it. I don't agree that it makes the script code easier to read with lots of parens hanging around, but I still think it's a useful technique--I like the filtering too.&lt;/p&gt;&lt;p&gt;Thanks for the nice tip!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dan</dc:creator><pubDate>Fri, 11 Jan 2008 08:54:55 -0000</pubDate></item><item><title>Re: On handling logging in a script</title><link>http://www.dannorris.com/2008/01/11/on-handling-logging-in-a-script/#comment-1921063</link><description>&lt;p&gt;Dan&lt;/p&gt;&lt;p&gt;Another approach (which also works on Windows) is to place the commands you want to log into a bracketed section&lt;/p&gt;&lt;p&gt;(&lt;br&gt;commands to be logged&lt;br&gt;more commands to be logged&lt;br&gt;) &amp;gt; $LOG&lt;/p&gt;&lt;p&gt;This has the added benefit on *nix that you can easily tee and grep the output. So you can log *everything* to a file, but filter out (say) significant progress and error messages. I tend to start my messages with == (the more equals signs, the more important) and then you can filter messages by how many == they have:&lt;/p&gt;&lt;p&gt;(&lt;br&gt;commands&lt;br&gt;) | tee $log | grep "^==="&lt;/p&gt;&lt;p&gt;Of course on *nix you can also redirect stderr at the same time in the usual way(s) eg:&lt;/p&gt;&lt;p&gt;(&lt;br&gt;commands&lt;br&gt;) &amp;gt;2&amp;amp;1 &amp;gt;$LOG&lt;/p&gt;&lt;p&gt;I think using brackets (braces) like this is easier to read - and you can nest the brackets too. Just make sure you match brackets properly.&lt;/p&gt;&lt;p&gt;Regards Nigel&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nigel Thomas</dc:creator><pubDate>Fri, 11 Jan 2008 04:55:48 -0000</pubDate></item></channel></rss>