'From etoys3.0 of 7 March 2008 [latest update: #2115] on 29 August 2008 at 3:43:34 pm'! "Change Set: errlog-bf Date: 29 August 2008 Author: Bert Freudenberg The error logged to the console was cut off occasionally."! !SystemDictionary methodsFor: 'miscellaneous' stamp: 'bf 8/29/2008 15:08'! logError: errMsg inContext: aContext to: aFilename "Log the error message and a stack trace to the given file." | ff | [Preferences logDebuggerStackToConsole ifTrue: [FileStream stderr ifNotNilDo: [:stderr | stderr nextPutAll: '=========== '; nextPutAll: aFilename; nextPutAll: ' START =========='; cr; nextPutAll: errMsg; cr; nextPutAll: (String streamContents: [:strm | aContext errorReportOn: strm]); nextPutAll: '=========== '; nextPutAll: aFilename; nextPutAll: ' END =========='; cr]]] ifError: ["ignore"]. FileDirectory default deleteFileNamed: aFilename ifAbsent: []. (ff _ FileStream fileNamed: aFilename) ifNil: [^ self "avoid recursive errors"]. ff nextPutAll: errMsg; cr. aContext errorReportOn: ff. ff close. ! !