Thoughts - logging inside Haiku

All,

When trying to get things like FuseSMB and the mail_daemon to work, I’ve always struggled because applications/services don’t seem to log anywhere useful.

For the most part, as pointed out by @PulkoMandy, applications generally log to stdout, which is kind-of OK for apps that can run in a Terminal but not as useful for daemons.

My statement is - can developers consider logging to a central location such as /var/log/log.XXX?

This means that if we’re logging application output such as mailer_daemon, FuseSMB, etc, users will be able to check the logs to understand why things might not be working as designed?

Also, is there any API inside Haiku that could be modified to dump output to a certain location or would a new API be a good idea?

Many thanks,

Dave

Dumping to syslog is quite easy, see SyslogTest.cpp.
Not sure there needs to be an API for “individual” logging…

That’s really cool… So perhaps people could use that a little more! :slight_smile:

I suppose my main thought here is “how can we make it easier for users to diagnose issues themselves”. Perhaps some kind of Log Viewer application could help there… I’ll think it over.

Dumping text to some log file for finding errors isn’t very user friendly IMO. If the error case is somehow actionable for the user (i.e. there’s something the user can do or check to possibly make it work themselves) it should be presented as such to them (dialog box, notification message, or similar). If it’s not actionable, highly technical debug output, then it’ll usually be quite verbose and dumping all that in some obscure (to the user) location of the filesystem isn’t nice either. Especially not by default. In such cases I’d favour the applications or system services to have a “save debug log” type setting, which e.g. creates a log – on demand – in the home directory.

That’s not a bad idea actually, regarding the Save Debug Log setting…

I agree with your comments about applications that the user starts; for daemons it’s a different kettle of fish; all mainstream OSs (with the exception of Haiku) have some kind of eventing strategy… Windows has its Event Viewer, OS X has its Console and Linux distros have various System Log viewers.

I do quite like the OS X Console (http://www.macworld.com/article/3102847/macs/hands-on-with-macos-sierras-console-now-its-easier-to-get-the-mac-information-you-need.html) as it provides a number of filtering and hilight abilities to allow users to drill down and constrain the errors that appear…

Perhaps it would be better to log too much information inside /var/log than none at all…?

(Of course, one day Haiku won’t need any error logging at all because none of its components will fail, but until then…)

(Just my $0.02)

For now, the way to go for daemons is to use syslog(). While it currently all gets to the single /var/log/syslog file, at least it leaves the OS in control of what to do with the logs, which means we can implement better strategies on the OS side (such as an event viewer, a way to extract the logs for a specific app after the fact, etc).