Logging
Sometimes it is very helpful to instrument the code with some output statements
and log that to a file. in ObjectStudio we use the statement #out, which can be
sent to a String and writes the content to the transcript. If you want to write
the content of the transcript to a file, you must specify the '-o' parameter at
the command line (e.g. 'ostudio.exe -iostudio.img -ologfile.txt').
Now with OS8 we introduce a new API:
GlobalDictionary>>setProgramWindowLog:
this way you can set the log file from Smalltalk and don't have to specify it at
the command line. The advantage is, even for longer running applications you can
now generate new log files every day. If you generate the name of the log file
and for example, add a timestampe to make sure, you get the most information
from your code.
The only thing you need to keep in mind is, those files get overwritten! The
code does not check, if the file already exists an appends the output. Instead
the file starts over again. It is the engineers reponsibility to make sure, you
don't overwrite your own logs. Just as the regular '-o' statement does too.
So, be careful.
Andreas
---------------------------------------------
Quis Custodiet Ipsos Custodes?
Comments
missing out
[ Troy Brumley] February 5, 2007 8:03:34.926
Comment by Troy Brumley
If I'm doing any significant work in VW, I always implement #out up in Core.Object as "Transcript show: self printString; cr". #out seems much more natural than sprinkling my own code with the "Transcript show:" idiom.
Re: Logging
[Hippie] May 21, 2011 12:36:53.667
Such a deep anwesr! GD&RVVF
Re: Logging
[Hippie] May 21, 2011 12:36:55.886
Such a deep anwesr! GD&RVVF
Re: Logging
[Hippie] May 21, 2011 12:36:57.795
Such a deep anwesr! GD&RVVF
Re: Logging
[Jobeth] September 28, 2012 10:50:57.588
It's impertavie that more people make this exact point.