Re: Apple system log facility: questions
Re: Apple system log facility: questions
- Subject: Re: Apple system log facility: questions
- From: Marc Majka <email@hidden>
- Date: Thu, 16 Nov 2006 12:45:55 -0800
Yes, asl_open() is broken and ignores the Facility on Tiger. Sorry
about that. It's been fixed in Leopard. You can work around it by
adding a "Facility" to the message that you are sending. Here's a
small example:
#include <stdlib.h>
#include <asl.h>
int main(int argc, const char *argv[])
{
aslmsg m;
m = asl_new(ASL_TYPE_MSG);
asl_set(m, "Facility", "Foobar");
asl_log(NULL, m, ASL_LEVEL_ERR, "Hello World");
asl_free(m);
return(0);
}
About the "Facility" key: In it's original design, there was no
notion of a facility at all in ASL. ASL was added to Tiger on a very
tight schedule, and we missed the fact that we really should have
added a #define for ASL_KEY_FACILITY. That was regrettable, but it's
much more of an inconvenience than anything else.
About "Reverse ICANN". I picked up this name from somewhere as a way
of describing namespaces of the form "com.apple.foo.bar". If you
know a formal term for this namespace convention, please let me know
and I'll change the man page. ICANN (the Internet Corporation for
Assigned Names and Numbers) manages the domain name space, which
includes names of the form "x.y.z.apple.com". The "reverse"
convention: "com.apple.z.y.x" is widely used as a namespace for a
number of different applications.
You are quite right that names like "user", "deamon", "kern", and so
on do not obey this informal naming convention. These are the legacy
names that are part of the syslog(3) API, and that are still
supported as part of ASL. We didn't design ASL as a complete
replacement for syslog. That would have been a futile exercise. We
designed it to be a superset of syslog, that worked with legacy code
(the syslog(3) API, network log message passing over UDP, and
existing kernel API), and which matched the expectations of "legacy"
users of syslog (/etc/syslog.conf and all the usual output files).
It would have been kind of stupid on our part to simply decree that
the "kern" facility would not be supported, and force everyone to
adopt "com.apple.system.kernel" as a new facility name. Users and
kernel engineers would have been lined up outside my door with
pitchforks and flaming torches. Over time, we'll try to encourage
legacy systems and users to adopt the new convention, but it needs to
be a gentle transition.
What the man page is trying to say is this: we should all be nice and
share the facility namespace. If you are inventing a new
application, and you want to give it a new facility name, then we
encourage you to give it a facility name that won't collide with some
other developer that is also inventing some new application. For
example, if you are writing some new RSS system, it would be better
to use the name "com.integro.rss" than just "rss".
--
Marc Majka
On 16 Nov, 2006, at 03:01, Stephane wrote:
o is it worth and clever to use asl in Tiger?
Reading this post in the archive:
"Subject: Re: Configuring syslog.conf for custom facilities.
From: *******
Date: Mon, 2 Oct 2006 10:23:12 -0700
[...]
But due to a bug in asl_open(), it doesn't. Sorry about that! The
bug will be fixed in 10.5 (Leopard).
"
makes me think asl could be like the Launchd Agent technology:
available but broken.
o why is there no constant defined for "Facility"?
o is there any real readable documentation somewhere?
I mean:
- the man page for all asl_ API is not a real man page. It
describes the facility globally but not the APIs. man fopen vs man asl
- the header asl.h is not headerdoc-ed
- there is no better documentation in the ADC Reference Library
o Facility name:
"We're encouraging developers to try to use a "Reverse ICANN"
naming convention for facility names to avoid namespace conflicts."
What does it mean exactly?
[Facility install], [Facility daemon], [Facility user], [Facility
authpriv] does not highlight any "Reverse ICANN" naming convention
AFAIK.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden