[BUG][FIX]SystemDictionary>logError:inContext:to: recursive failure

Mark A. Schwenk mas at wellthot.com
Wed Jul 28 20:43:16 UTC 1999


Here is a simple-minded fix that keeps Squeak from going off the deep when it attempts to report an error and the log debug stack to file preference has been set but the SqueakDebugLog.txt file cannot be opened.

I noticed this because my Squeak directory was not writable by me. There are many other uses of FileStream that fail ungracefully under such conditions (such as filing out), though not in a recursive loop like the above failure.  We should investigate these when we have added Exception support.

-Mark Schwenk
 WellThot Inc.

'From Squeak 2.4c of May 10, 1999 on 28 July 1999 at 3:37:41 pm'!

!SystemDictionary methodsFor: 'miscellaneous' stamp: 'mas 7/28/1999 15:05'!
logError: errMsg inContext: aContext to: aFilename
	"Log the error message and a stack trace to the given file."
	| ff ctx |
	FileDirectory default deleteFileNamed: aFilename ifAbsent: [].
	(ff _ FileStream fileNamed: aFilename)
		ifNotNil: [
			ff nextPutAll: errMsg; cr.
		  	Date today printOn: ff.  ff space.
			Time now printOn: ff.  ff cr.
			"Note: The following is an open-coded version of ContextPart>>stackOfSize:
			since this method may be called during a low space condition and we might
			run out of space for allocating the full stack."
			ctx _ aContext.
			[ctx == nil] whileFalse:[
				ff print: ctx; cr.
				ctx _ ctx sender].
			ff close]! !





More information about the Squeak-dev mailing list