<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: ASL: Wrap-up</title>
	<atom:link href="http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up/feed" rel="self" type="application/rss+xml" />
	<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up</link>
	<description>The personal weblog of Peter Hosey.</description>
	<pubDate>Wed, 08 Oct 2008 07:04:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-206931</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Sun, 29 Jun 2008 11:11:24 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-206931</guid>
		<description>Mattias: Console's use of a table view suggests that it's probably working with aslmsg objects, not any of the external representations. Remember, those are database queries, not plain-text log files.</description>
		<content:encoded><![CDATA[<p>Mattias: Console's use of a table view suggests that it's probably working with aslmsg objects, not any of the external representations. Remember, those are database queries, not plain-text log files.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mattias</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-206926</link>
		<dc:creator>Mattias</dc:creator>
		<pubDate>Sun, 29 Jun 2008 10:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-206926</guid>
		<description>Excellent series of posts, congratulations on helping the world becoming a better place for us programmers.

Now, I've noticed that if I set the ASL_OPT_STDERR flag, I really cannot seem to get my printouts to have proper linebreaks in my shell (nor in Xcode's terminal). I recognize that this is the same problem as you reported in rdar://problem/5695926. Take this as an example: "This is\n a linebreak \n and here comes one more\n". That string will be printed exactly as is, that is \n isn't treated like a line break. However, Console.app seems to be displaying the string just as I intended it to be seen, with \n converted to a newline.

Again; thanks for some really good posts.</description>
		<content:encoded><![CDATA[<p>Excellent series of posts, congratulations on helping the world becoming a better place for us programmers.</p>
<p>Now, I've noticed that if I set the ASL_OPT_STDERR flag, I really cannot seem to get my printouts to have proper linebreaks in my shell (nor in Xcode's terminal). I recognize that this is the same problem as you reported in rdar://problem/5695926. Take this as an example: "This is\n a linebreak \n and here comes one more\n". That string will be printed exactly as is, that is \n isn't treated like a line break. However, Console.app seems to be displaying the string just as I intended it to be seen, with \n converted to a newline.</p>
<p>Again; thanks for some really good posts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-169607</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Wed, 27 Feb 2008 04:47:27 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-169607</guid>
		<description>Brian K.: You're absolutely right. Fixed.</description>
		<content:encoded><![CDATA[<p>Brian K.: You're absolutely right. Fixed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian K.</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-169599</link>
		<dc:creator>Brian K.</dc:creator>
		<pubDate>Wed, 27 Feb 2008 03:42:21 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-169599</guid>
		<description>&lt;p&gt;As pointed out by others, excellent, well detailed series.&lt;/p&gt;

&lt;p&gt;I think in your summary, the asl_log call is missing a parameter for level:&lt;/p&gt;

&lt;pre&gt;asl_log(client, /*msg*/ NULL, "printf-style format; interpolates values, such as %i", 42);&lt;/pre&gt;

&lt;p&gt;should be (?):&lt;/p&gt;

&lt;pre&gt;asl_log(client, /*msg*/ NULL, ASL_LEVEL_XXX, "printf-style format; interpolates values, such as %i", 42);&lt;/pre&gt;

</description>
		<content:encoded><![CDATA[<p>As pointed out by others, excellent, well detailed series.</p>
<p>I think in your summary, the asl_log call is missing a parameter for level:</p>
<pre>asl_log(client, /*msg*/ NULL, "printf-style format; interpolates values, such as %i", 42);</pre>
<p>should be (?):</p>
<pre>asl_log(client, /*msg*/ NULL, ASL_LEVEL_XXX, "printf-style format; interpolates values, such as %i", 42);</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-163406</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Sun, 10 Feb 2008 18:05:25 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-163406</guid>
		<description>Ken T.: Very good suggestion. Thanks.</description>
		<content:encoded><![CDATA[<p>Ken T.: Very good suggestion. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken T.</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-163338</link>
		<dc:creator>Ken T.</dc:creator>
		<pubDate>Sun, 10 Feb 2008 14:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-163338</guid>
		<description>I would recommend using the pthread per-thread data routines:

Early in your application startup, create a key for the per-thread ASL connection using pthread_key_create().  Pass in a destructor routine that closes the connection.  That way, each thread's connection will be automatically closed when that thread exits.  Store the key in a global variable.

When you need to log, call pthread_getspecific() to obtain the thread's ASL connection.  If it comes back NULL, then this is the first time you're logging for that particular thread.  In that case, create the connection for the thread and store it using pthread_setspecific().  The business of getting the connection and creating it if necessary should be hidden within a function, naturally.

If you prefer, in Cocoa you can use -[NSThread threadDictionary] to store the connection.  In that case, you'd define your own class for holding an ASL connection, whose dealloc would close the connection.  This seems to add complexity for no apparent benefit, though.</description>
		<content:encoded><![CDATA[<p>I would recommend using the pthread per-thread data routines:</p>
<p>Early in your application startup, create a key for the per-thread ASL connection using pthread_key_create().  Pass in a destructor routine that closes the connection.  That way, each thread's connection will be automatically closed when that thread exits.  Store the key in a global variable.</p>
<p>When you need to log, call pthread_getspecific() to obtain the thread's ASL connection.  If it comes back NULL, then this is the first time you're logging for that particular thread.  In that case, create the connection for the thread and store it using pthread_setspecific().  The business of getting the connection and creating it if necessary should be hidden within a function, naturally.</p>
<p>If you prefer, in Cocoa you can use -[NSThread threadDictionary] to store the connection.  In that case, you'd define your own class for holding an ASL connection, whose dealloc would close the connection.  This seems to add complexity for no apparent benefit, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-159078</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Tue, 29 Jan 2008 21:23:23 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-159078</guid>
		<description>Jeff: I got a similar question by email.

If you have multiple objects that each use one (&lt;em&gt;and only one&lt;/em&gt;) thread, you can just put the connection in their class as an ivar.

If you have one object which messages from multiple sources pass through, I would suggest using &lt;code&gt;performSelectorOnMainThread:&lt;/code&gt; to fob all the logging off on the main thread. This is a bottleneck, but you'd need &lt;em&gt;a lot&lt;/em&gt; of messages to come in at the same time to cause a performance problem.

I should probably add this to the client connections post.</description>
		<content:encoded><![CDATA[<p>Jeff: I got a similar question by email.</p>
<p>If you have multiple objects that each use one (<em>and only one</em>) thread, you can just put the connection in their class as an ivar.</p>
<p>If you have one object which messages from multiple sources pass through, I would suggest using <code>performSelectorOnMainThread:</code> to fob all the logging off on the main thread. This is a bottleneck, but you'd need <em>a lot</em> of messages to come in at the same time to cause a performance problem.</p>
<p>I should probably add this to the client connections post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Johnson</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-159004</link>
		<dc:creator>Jeff Johnson</dc:creator>
		<pubDate>Tue, 29 Jan 2008 15:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-159004</guid>
		<description>Thanks, Peter!  Great work.  Maybe the ADC docs should just point here. ;)

Question: what's your view on how to deal most effectively with logging from multiple threads in an app?</description>
		<content:encoded><![CDATA[<p>Thanks, Peter!  Great work.  Maybe the ADC docs should just point here. ;)</p>
<p>Question: what's your view on how to deal most effectively with logging from multiple threads in an app?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blake C.</title>
		<link>http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-158901</link>
		<dc:creator>Blake C.</dc:creator>
		<pubDate>Tue, 29 Jan 2008 07:23:46 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-01-28/asl-wrap-up#comment-158901</guid>
		<description>A most excellent series of posts, sir! I've learned quite a bit from your research, and I look forward to more of the same. Thanx much for taking the time to share this with us all :)</description>
		<content:encoded><![CDATA[<p>A most excellent series of posts, sir! I've learned quite a bit from your research, and I look forward to more of the same. Thanx much for taking the time to share this with us all :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.195 seconds -->
