2010-02-02

Syslog in php

To Log your error in syslog using php use this :
             /*
            ** Logging Data showing error
            */
            openlog("myScriptLog", LOG_NDELAY, LOG_LOCAL6);
            your code here
            syslog(LOG_DEBUG, "Non Availability of Participant ID");
            closelog();

Before this make a entry in syslog.conf :
local6.*                                                /var/log/php.log

* represents that all types of logs get entered in  /var/log/php.log

Restart the syslog using : service syslog restart

now run your code.

Remember if you use LOG_PERROR then logs will get displayed also in console/code.