I am trying to design the error and warning log file for my desktop program.
As my program reads the user's input file, it may find syntax errors or invalid data of some sort. Once everything is read and the program is processing the data, more problems may be found.
I want to write messages about these into a simple text file. I may also want to include informational text to indicate progress, time, memory use, etc. I'll want to include line numbers and maybe even the actual input lines that are causing the errors.
This will be a file that the user will want to browse through, so obviously it has to be well laid out and easy to use.
Do you know of any style guides for this, or have you seen an error log file that has made you think to yourself: "Now that's a well designed log file!"
Followup:
The first three answers are actually more applicable for a server or event log.
I'm really looking for a format for a log file for my desktop program to detail any problems it finds with the input file and the success (or failure) of its processing thereof.
I'm sure there are some desktop applications that you've used that produce such log files. Have you seen any good ones?
The JSON (JavaScript Object Notation) is a highly readable data-interchange format that has established itself as the standard format for structured logging. It is compact and lightweight, and simple to read and write for humans and machines.
W3C Extended format is a customizable ASCII format with a variety of different properties. You can log properties important to you, while limiting log size by omitting unwanted property fields. Properties are separated by spaces. Time is recorded as UTC.
syslog
and log4j
are widely used formats with which sysadmins may be familiar, and there are tools for working with them. You should at least look at them before doing your own format.
For Windows it's pretty much always the Application Event Log, which I don't really like as much as a text file, but it's the Right Way. I've seen a few apps that write text files in their program directory or something, but it's always ad hoc, never standard. McAfee VirusScan, for example, logs files in C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection. My machine has lots of install logs in C:\Documents and Settings\username\Local Settings\temp*.log and C:\WINDOWS\temp*.log. But again, they're all different and ad hoc and not noticeably well-designed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With