tags:

views:

361

answers:

4

Do any apps/packages exist that will support writing to OS X's log database from external sources. I'm not too familiar with the specifics of the database, beyond the fact that you can view its contents from the Console app. I'm not even sure if it's just a version of some simple DB like SQLite or if it is some sort of proprietary/internal/inaccessible kind of thing.

My best guess so far is that one of two things might be possible:

  • It looks like it will accept log entries from natively run apps, so perhaps using some sort of daemon running in the background that could take text inputs and relay it to the log database would work?

  • The other alternative that came to mind was if there were some way to access the database directly, in which case a PHP script could simply connect to it to make log entries.

If anyone more knowledgeable could fill in the blanks, I would be very grateful!

+3  A: 

I've never used OS X but you might want to look into the syslog function.

Greg
That actually might do the trick! I'll look into it and post up my findings.
Wilco
A: 

OS X does use SQLite as part of CoreData. I am under the impressions that it is the primary means for storing data locally with OS X so I would expect it logs with it as well.

gaoshan88
Why would such a frequently hammered subsystem waste time performing SQL inserts when all it needs to do is stick a line at the bottom of a text file?
Azeem.Butt
+1  A: 

The log files are plain text, found in (~)/Library/Logs. OS X, like most *nix systems uses a syslogd process to which you can log using syslog as mentioned by RoBorg.

jackrabbit
+1  A: 

In your PHP do a syslog(LOG_WARNING, "whatever");

In terminal type syslog -w

It will output Warning: whatever

It will then print out the syslogs. You will get system message as well in the syslog. The -w help only list recent stuff.