Here's a quick tip that is a real time saver in some situations. As a developer you often come across programs, tools or servers that produce output in form of a log file. Or maybe - and this includes myself - you use logs for debugging purposes.

In ColdFusion for example I regularly find myself adding cflog tags to my code in order to get a view into what my code is doing. Having to open and close log files constantly can be tedious at best, but luckily there is a really simple way of displaying a live view of the most recent entries using the standard Unix tail -F command.

Whereas tail on its own simply displays the last part of a file, the -F option will not stop when the end of the file is reached but will keep monitoring the file for new lines and displaying them, thereby giving you effectively a live console view into the file.

Taking ColdFusion logs as an example, here's how you'd monitor a particular log file (mine are typically named according to the site or application I am working on):

view plain
1cd /Applications/ColdFusion9/logs/
2tail -F playingornot.log
3"Information","jrpp-4","02/21/12","17:40:30","PLAYINGORNOT","/index.cfm"
4"Information","jrpp-5","02/21/12","17:40:33","PLAYINGORNOT","/index.cfm"
5"Information","jrpp-5","02/21/12","17:40:35","PLAYINGORNOT","/cfc/Auth.cfc"
6"Information","jrpp-5","02/21/12","17:40:35","PLAYINGORNOT","/cfc/Players.cfc"
7"Information","jrpp-5","02/21/12","17:40:36","PLAYINGORNOT","/cfc/PlayTimes.cfc"
8"Information","jrpp-1","02/28/12","09:37:37","PLAYINGORNOT","/index.cfm"
9"Information","jrpp-1","02/28/12","09:37:40","PLAYINGORNOT","/cfc/Auth.cfc"
10"Information","jrpp-1","02/28/12","09:37:41","PLAYINGORNOT","/cfc/Players.cfc"
11"Information","jrpp-1","02/28/12","09:37:42","PLAYINGORNOT","/cfc/PlayTimes.cfc"
12"Information","jrpp-2","02/28/12","09:40:30","PLAYINGORNOT","/cfc/PlayTimes.cfc"

As my application runs I can see new entries being displayed in real time in my log file - very handy. This particular log is produced by adding

view plain
1<cflog file="#this.name#" type="information" text="#arguments.targetPage#">
to my Application.cfc's OnRequestStart handler.

This technique works for any kind of text based log file on operating systems that have the tail command or similar available.