Dec. 21st, 2009

grimsniffer: (Default)
[personal profile] grimsniffer
So - I thought it might be useful to start a discussion about this, so here goes:

What are some of the debugging methods you use? I'm not talking modus operendi or bug walk-throughs. I'm speaking of the things you do when your code's not working and you need to see with your eyes what's going on.
Here are some of the ones I use, I'd love it if people can pitch in and add their own:

Javascript:
* alert()s. I add them in strategic points in my code to see what the values of certain variables are (I find this more convenient than Firebug, especially in situations where variables change their values in fractions of seconds).
* Firebug. I think there's probably been a few posts or wiki pages about it, so I won't say much more - but it's hellishly useful.

MySQL:
* querry.log. It's not enabled by default, but you can very easily enable it like shown here: http://dev.mysql.com/doc/refman/5.1/en/query-log.html. It slows down performance somewhat, but if you're not working on a live server it shouldn't be a problem.
* Connecting to the database and looking at values in tables. This is as simple as: 'mysql -uroot -p' and then entering your password. If you see what tables you're writing to, what columns you're reading from and so know what values you're supposed to get - life becomes easier. :)

Apache:
* All of apache's logs are in /var/log/apache - at least on my setup you need to be root to read them. 'tail -f logname.log' lets you see them as they're updated dynamically. You get everything from server specific information "service is up, service is down" etc. to function calls that have gone awry in the perl code (though I wouldn't count on this 100% obviously).

Perl:
* Using system() to print the values of certain variables into files and then 'tail -f'ing the files live.
* Printing variables, messages, etc. into HTML tags where applicable (messy, but sometimes necessary).
* Some other things that don't come to mind at the moment, but I'll edit in as I remember. :)

So - what are some of the methods you use that I haven't mentioned here? I think it might be a good idea to organize these and make a small wiki page out of them for reference.

Profile

dw_dev_training: The stylised 'd', with the word 'dev' above, and the word 'training' at the side, representing the dw_dev_training comm. (Default)
Dreamwidth Development Training

September 2022

S M T W T F S
    123
45678910
1112131415 1617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 28th, 2025 12:15 pm
Powered by Dreamwidth Studios