A great way to improve the testability of your software is to add logging! A log with all errors, warnings, faults, exceptions, dialog messages, or whatever is interesting for you in one file!
For most programmers it is relative easily to build in logging. When an application has a single class/procedure/library to handle errors, it is easy to build in logging. Depending on what you log it could become very easy for programmers to find the causes of crashes/bugs. If you are able log all user actions, it is just a matter of walking through the log file for the reproduction steps. Additionally, not all problems are visible in the GUI, sometimes a problem is only reported in a log file or some strange output is written to the log file.
However, when you have several servers up and running (database, application server, web server) it could produce a lot of logging. Testers are also humans.. so it could happen that you miss an important message in the log….
James Bach recognized this problem and wrote a small application in Perl to watch the log automatically. A great tool. However, the tool has some issues (for me):
- When you have several logs to watch, an application is started for every log file. As a result, the Windows task bar is polluted by extra programs on the taskbar;
- When you start the application, the old log is also watched. As a result, all already know issues are reported;
- Only explicit audio feedback, when the application is minimized there is no visual feedback;
- The application is no longer visible in the task bar, it is visible in the notification area;
- When the application is started, it does not parse the existing log content;
- There is also visible feedback, by using a dialog;
- The option to open the log file directly from the notification icon;
File | Description |
audio_logwatch.bat | An example file to start multiple instances of logwatcher.exe to watch files. |
error.wav | Sample wav file, that gives you the raspy voice of James Bach during a bout of bronchitis. |
license.txt | The program is released under the GPL 2.0 license. |
logwatcher.au3 | The source code of the program. |
logwatcher.exe | A compiled version of the script, ready to be used. |
readme.txt | A file with some information about the tool and credits to James Bach. |
watchlist.txt | The file that contains the patterns to look for in the log files. |
Hi! Can you make an option for logwatcher to create a file with the exceptions found? The pop-up is a bit annoying for me as I would like to be alerted only by the sound and later check the error messages. Otherwise thumbs up!
Thanks for your comment.
I try to to minimize the features as much as possible. With every feature, a bug could be introduced ;).
However, if you download http://www.autoitscript.com/ yourself, it is relative easily to change the script.
Open the file logwatcher.au3 and remove the line: MsgBox (0, “LogWatcher (Closes automatically in 15 seconds)”, “Search pattern: ” & $searchpattern & @CRLF & “File: ” & $log_filename & @CRLF & @CRLF & “Log: ” & $aRecords[$x],15). This line shows the dialog.
In the current version (made it available this morning), the icon in the notification area has an option to open the log file directly. I think saving the errors to a separate log is not efficient. The error is already there on your disk… Of course feel free to add this feature to your personal version.
To give you a quick start, look at the example of the procedure FileWrite in the help file of AutoIT, replace the line you have removed above, with a FileWrite statement. Just send me an email if you have any questions or ask for help on the AutoIT user forum.
Thanks I'll give it a try! Another thing to note is that I am unable to hide the icons in the system tray in win XP. I have set the icons to always hide and they are hidden, but once I kill logwatcher.exe and restart them, the icons reappear as visible each time. Any comments on that? R.
No comments on that 😉 It is handled by AutoIT itself, try the autoit forum for more info on this.
I was able to modify the source so that the program does exactly what I needed. Thanks again for the help : )