[Scummvm-devel] Log file support

Johannes Schickel lordhoto at scummvm.org
Wed Nov 24 01:41:47 CET 2010


Hi,

as you might have noticed I implemented a simple class which aids 
backends in supporting logging to a file.
See this 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=3115757&group_id=37116 
tracker item and this commit 
http://scummvm.svn.sourceforge.net/viewvc/scummvm?view=revision&revision=54451 
for more information.

There are some unresolved questions about how we properly hook it up in 
our backends though. This is a usually highly backend specific question. 
I think for most backends its maintainer can decide this freely. The 
main problem is the SDL backend here, since it is used by many more 
people on different platforms. Thus all the below mentioned points are 
mainly targeted at the SDL backend.


1) Log strategy

We can basically have two different logging strategies:

a) only have one log file, which is overwritten on every run.
b) have a fixed maximum of log files and always reuse the oldest one on 
startup (i.e. log rotation).
c) have an unlimited number of log files.

Some pros/cons for a and b are listed over here: 
http://wiki.scummvm.org/index.php/Windows/Console#Pros_.28Arguments_for_logging_to_a_file.29 
Note that this page mainly focuses on the windows console, which is not 
part of this discussion, so please abstain from bringing this up here.

One pro argument for c)

- The user would never lose logs on a specific ScummVM run

One (big) con argument for c)

- We would eat up more and more space. This gets especially nasty when 
we ask users to do a -d9 test run for example.

Personally I would say c) is not really a good idea. I never the less 
listed it here in case any of you thinks its superior.


2) Name scheme.

I think this is only a real big problem in case we chose either b or c 
in 1). If we rely on a single log file I would propose to just call it 
"scummvm.log".

If we chose b or c a possible option would be to add the date/time to 
the log file name. If you have other suggestions please tell us about them.

For b) I think we could also use a filename set of "scummvm-1.log", 
"scummvm-2.log" etc. This has the advantage that it is relatively easy 
to implement but rather confusing for the user to find out which log 
file he should look at / submit. There are different approaches to "fix" 
this, i.e. rename the log files on startup or use names with date/time 
in them (like above) and remove the oldest one.

So if somebody has an opinion about this, please just raise your voice.

3) Placement of the log files

We need to decide where to place the log file(s) on Windows, Mac OS X 
and UNIX-like systems.

Max already made a proposal where to store them on Mac OS X:

a) Store them in ~/Library/Logs/
b) Store them in a sub-directory thereof, i.e. ~/Library/Logs/ScummVM

a) sounds fine for me when we agree on only having a single log file. I 
would prefer b) in case we want to have log file rotation though. since 
that should make finding the logs easier for users. If you are a 
developer using Mac OS X and you have some opinion about this, please 
tell us about it.

For UNIX-like systems I would like to propose ~/.scummvm. That is the 
default directory for our save files already. While this is not that 
ideal, since it would mix save files with the logs, I think we can 
either make two sub-directories there (i.e. save/ and logs/) or just mix 
them, since most users will change their default save path anyway (I 
think...).

We also need to come up with a place where to store logs on Windows. 
Since I am not familiar with how programs handle that nowadays I can not 
make any proposal here. Kirben do you have any idea here? Or anyone else 
(who is using Windows on a regularly base)?

// Johannes




More information about the Scummvm-devel mailing list