<?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>rob aldred &#187; logging</title>
	<atom:link href="http://robaldred.co.uk/tag/logging/feed/" rel="self" type="application/rss+xml" />
	<link>http://robaldred.co.uk</link>
	<description>cars, f1, bikes, tech tips &#38; what ever i&#039;m interested in this week</description>
	<lastBuildDate>Thu, 15 Apr 2010 13:54:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Restarting syslog process on Mac OSX</title>
		<link>http://robaldred.co.uk/2009/05/restarting-syslog-process-on-mac-osx/</link>
		<comments>http://robaldred.co.uk/2009/05/restarting-syslog-process-on-mac-osx/#comments</comments>
		<pubDate>Fri, 29 May 2009 11:31:45 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Mac Tips]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/?p=71</guid>
		<description><![CDATA[I&#8217;ve been working on a project which uses syslog. In order for the changes I made to syslog.conf to take effect I needed to restart the syslogd process Yes I could restart my computer but that&#8217;s just too much effort. I found a simple solution using the built in Mac Launch Daemons ~#: launchctl unload [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a project which uses syslog.<br />
In order for the changes I made to syslog.conf to take effect I needed to restart the syslogd process</p>
<p>Yes I could restart my computer but that&#8217;s just too much effort.<br />
I found a simple solution using the built in Mac Launch Daemons</p>
<pre lang="shell">
~#: launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
~#: launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
</pre>
<p>syslogd will now have reloaded with any config changes you made.</p>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2009/05/restarting-syslog-process-on-mac-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom log files for your ruby on rails applications</title>
		<link>http://robaldred.co.uk/2009/01/custom-log-files-for-your-ruby-on-rails-applications/</link>
		<comments>http://robaldred.co.uk/2009/01/custom-log-files-for-your-ruby-on-rails-applications/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 15:38:47 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/?p=27</guid>
		<description><![CDATA[Sometimes logging is required but putting the messages in the Rails log isn’t the answer.For example you need to see the progress of customers through your order placement cycle, you ideally need this seperate to any other in a custom log file? There is a solution and it&#8217;s easy&#8230; To create an order progress log, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes logging is required but putting the messages in the Rails log isn’t the answer.For example you need to see the progress of customers through your order placement cycle, you ideally need this seperate to any other in a custom log file?</p>
<p>There is a solution and it&#8217;s easy&#8230; To create an order progress log, simply create a new instance of <em>Logger</em> and pass it a <em>File</em> instance for your own logfile.<br />
Create a new model which inherits from <em>Logger</em></p>
<pre lang="ruby">class OrderProgressLogger &lt; Logger
  def format_message(severity, timestamp, progname, msg)
  "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
  end
end</pre>
<p>Create initializer called logs.rb in RAILS_ROOT/config/initializers with the following content:</p>
<pre lang="ruby">order_progress_logfile = File.open("#{RAILS_ROOT}/log/order_progress.log", 'a')
order_progress_logfile.sync = true
ORDER_PROGRESS_LOG = OrderProcessLogger.new(order_progress_logfile)</pre>
<p>After a restart of your mongrel or passenger <em>ORDER_PROGRESS_LOG</em> will be available through out your application.<br />
You log to it just as you would <em>DEFAULT_RAILS_LOGGER</em> like so&#8230;</p>
<pre lang="ruby">ORDER_PROGRESS_LOG.debug "Starting order placement method"
ORDER_PROGRESS_LOG.error "Could not create order record"</pre>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2009/01/custom-log-files-for-your-ruby-on-rails-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
