24. October 2010 22:37
Who would have guessed that PowerShell would come handy when developing PHP with Eclipse on Windows running against IIS7? But it’s a fact. There is this great one-liner for “tailing” any text file output in real time to the PowerShell console window or in my case the PowerShell ISE (Integrated Scripting Environment). PowerShell and the PowerShell_ISE are installed by default on any Windows 7 or Windows 2008 R2 machine and can be downloaded for older Windows operating systems from the Windows Management Framework web site.
Figure 1: Tailing the c:\windows\temp\php-errors.log file to the PowerShell ISE output window
Here is the very simple command that can save you some repetitive file opening time:
get-content C:\Windows\temp\php-errors.log -wait
Note: Depending on your php.ini settings the PHP error log file could be located somewhere else.
The following screencast shows the productivity improvement in action:
The Php error log is one of the text logs that I need to look at frequently. The other one is the VantagePoint EMI error log. In the next blog post I will extend this useful feature by demonstrating how easy it is to remotely monitor error log files using PowerShell Remoting.