Using a small notebook or legal pad helps me to focus on the problem at hand. If I notice a problem or bug, that I don’t have to fix to solve the current problem, I will write it down on the list of todo items for the program.
The other nice thing about writing down a todo list this way, is that it will grow and shrink over time. At the end of the day I have two lists: one with the things that I did that day, and one list with the things that I can work on the next time.
It’s still a good idea to create tickets in the bug tracker for the big problems.