On Fri, Apr 20, 2007 at 11:47:29AM +0900, Simon Horman wrote:
> On Thu, Apr 19, 2007 at 09:07:17PM +0200, Dejan Muhamedagic wrote:
> > Hello,
> > 
> > Recently I introduced a bug which today I fixed, but the whole
> > thing left unpleasant taste. The bug gets excercised in case
> > ha_logd has been setup to log through syslog. The problem is that
> > there are multiple programs logging with different tags (such as
> > heartbeat,cib,crm) whereas syslog allows us to specify a tag only
> > with openlog.
> > 
> > The current solution is to copy the tag to the string which was
> > used with openlog before each syslog(3) call. Not exactly optimal.
> > Another solution I could think of is to do closelog/openlog before
> > every syslog call. Neither this one is a winner.
> 
> I sense that the first idea may be problematic. I'm not
> sure that there is anything stopping syslog implementations from
> having a private copy of the tag, in which case subsequent modifications
> to the original buffer will have little effect.

This is how it has been working. I screwed up logging because I
failed to understand the subtleness of the idea. Afterwards, I
checked the glibc and that one has been ok due to the
implementation particulars. However, as you pointed out, on other
platforms all bets are off.

> For these reason I'd go for the closelog/openlog option. Perhaps
> it could be smart enough to only closelog/openlog if the tag
> differers from the previous occasion that syslog was called.
> I imagine that the performance penalty for this would be bearable,
> but its just a guess.

I always had an impression that the openlog has been a
comparatively light function. However, given the amount of logging
currently done...

> As for syslog, why on earth it doesn't give back a handle and thus
> allow you to have multiple syslogs open simultaneously has baffled
> me in the past.

Old times/old code perhaps?

> I guess another approach would be to fork of sysloging processes,
> I guess then each process could open up syslog with a different tag,
> and as long as you can IPC the logs to the relevant process, then
> it should work. Just an idea. Not sure if its workable.

Given the (syslog) circumstances this looks like the best
approach.

Thanks for the good analysis.

> 
> -- 
> Horms
>   H: http://www.vergenet.net/~horms/
>   W: http://www.valinux.co.jp/en/
> 
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

-- 
Dejan
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to