Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Windows, is there an equivalent to syslog or OS X's Console.app for logging specific errors?

I'm writing a cross-platform application and am digging into a bit of its error handling. One of my approaches has been to display a message box to the user with a user-friendly error message when something sufficiently bad has gone wrong, while printing more detailed developer-centric information to the system log, both for the serious errors and for less critical issues that don't require bugging the user directly. This way, I can ask the user to check for or send me any output from the app when reporting issues.

To this end, I can use syslog in linux and NSLog / Console.app in OS X. But I don't know of any equivalent feature in Windows that's accessible to the average user. I am aware of DebugView.exe and OutputDebugString(), but I don't consider that a good solution since DebugView doesn't come standard with Windows and is not very accessible -- it's pretty clearly meant to be used by developers.

What's the best approach here? Should I maybe have the app output to a log file somewhere reasonable and ask users to send that? Should I perhaps do the same in Linux and OS X instead of using their system-wide logging facility? Or something else? I'm curious what people do in this sort of situation and what's considered best practices.

like image 241
Bri Bri Avatar asked Sep 05 '25 17:09

Bri Bri


1 Answers

Pragmatically, writing a txt file somewhere is probably the best solution.

The official place to log application errors would be the Windows Event Log. But the complexity of this API is such a high barrier to entry that very few applications bother - consequently very few users bother to consult said event logs.

tl;dr - use log4cxx or a similar logging framework to write to a text file.

like image 127
Chris Becke Avatar answered Sep 08 '25 11:09

Chris Becke