I wanted an easy way to retrieve critical errors from my Apache error log. While i was finding a solution, Gulp came into the picture. First let me introduce you to Gulp.
I have used Gulp to automate following tasks in past:
- Compiling SCSS
- Compressing CSS
- Auto reloading my browser if CSS changes.
- Compiling Coffeescripts
Now it was time to use gulp for Apache notification. So I created Gulp task for the same. Here is the script.
First of all I have included 3 Gulp dependencies which is Gulp itself as i don't have gulp in my environment, Gulp notifier to display error notification and Gulp Intercept to Go through log file and retrieve the error.
I have defined Watch as default task. Default task is a task which Gulp keep running continuously. The task keep watching over the log file. Whenever the error log file changes, Task will go through the file and will retrieve recent errors and will display them.
The script will display mainly 2 types of critical errors:
- PHP Fatal Error
- PHP Parse Error
- Goto the cloned repository.
- First add path to your Apache's Php Error log file in variable "logPath". (Default is