tags:

views:

1037

answers:

5

I have a program that was written for linux and I am trying to build and run it on my MacOS 10.5 machine. The program builds and runs without problem, however it makes many calls to syslog. I know that syslogd is running on my mac, however I can't seem to find where my syslog calls are output to.

The syslog calls are of the form

syslog (LOG_WARNING, "Log message");

Any idea where I might find my log output?

+3  A: 

When in doubt, there's always man syslog.

You can find your messages in /var/log/syslog; my machine is set up out of the box to only include high level messages so you may need to have your settings.

You can also read the messages through syslog(1), or create a test message with a command like

$ syslog -s -l INFO "Hello, world."

use a severity of P ("panic") and you'll get an exciting message on your console immediately.

Charlie Martin
+4  A: 

You can also use the Console.app program to view logfiles. It's purdy.

Matthew Schinckel
+2  A: 

Building on Charlie's answer, I would like to add that you should take a look at the manpage of syslog.conf(5) and also take a peek at the file /etc/syslog.conf (which is where the syslog configuration is defined by default and also, as I see it, on OS X 10.5.x).

ayaz
+2  A: 

Mac OS X implements a superset of syslog's functionality. All of syslog is there, but as part of ASL.

Console, mentioned by Matthew Schinckel in his answer, is the GUI on ASL. It'll show you any messages that exist in the database, as fetched by queries listed in the sidebar. There are two queries by default; one only shows messages sent with the Console facility (as used by NSLog, among other things), whereas the other shows all log messages. Check the all-messages query; you'll probably find your message there.

That “all” does come with an asterisk. If you look in /etc/asl.conf, you'll see this line:

# save everything from emergency to notice
? [<= Level notice] store

Fortunately, in your case, the message will pass this check, since warning outranks (is a lesser number than) notice.

Peter Hosey
A: 

Check for a call to openlog somewhere in the program. After a call to openlog, syslog will save its output to that log file instead of the default location.

Peter Hosey