From: James Britt Date: 2004-09-18T00:49:16+09:00 Subject: Re: Debugging wxruby programs. R. Cheung wrote: > Hi, > > Yes, I've installed both ruby and wxruby. The problem I have is that > if the app fails to start, it is sometimes due to syntax errors and > sometimes due to runtime errors (e.g. a nil member variable, etc.). > Without a DOS/Command window, firstly, I've no idea if it's a syntax > error, secondly, even if it does start, I can't use 'print' to print > out debugging statements to help me find out where I got to and what > went wrong (OK, I can open an auxilliary window and write to that, but > I could lose that window if the app dies). How do you experts debug > wxruby apps? Any help would be appreciated. Have you tried to use a logger? require 'logger' $log = Logger.new( 'logfile.log' ) $log.level = Logger::DEBUG # Now place logging calls in your code $log.debug( "Haven't crashed yet! Good." ) I think the line number shows up someplace in each log-line prefix, but a quick hack if you're simply trying to trace key points is to use $log.debug( __LINE__ ) # DELETE_ME Easy to cut and paste through out code; easy to find and delete. Easy to read the line number. James