This extension can be used in Unix and Windows systems in order to route Yii logs through syslog/Windows Event Log.
Specially in Unix systems it may be useful if you want to route log messages in external log storage systems through syslog.
I am sure there are bugs or awful coding, but it was done in a short timeframe and you may consider this as a PoC.
Disclaimer: Don't use it in production or heavy loaded systems, there's no warranty that this piece of code won't explode your servers.
P.S: Windows Event support lacks of priorities, in case anyone has any idea, don't hesitate to share it in the forum discussion. UPDATE 9/9: The above bug is now fixed, thanks to Magomed :)
'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'ext.ESysLogRoute',//'CFileLogRoute', 'levels'=>'trace, info, error, warning', 'categories'=>'system.*', ), ), ),
You can change application log name and logging facility using the following params in config/main.php:
'params'=>array( 'logName' => 'Yii-Forum', 'logFacility' => LOG_LOCAL0, ),
The logFacility is not a string but an integer, refer to: http://us2.php.net/manual/en/function.openlog.php for details.
If you omit to define these application parameters it defaults to the following:
'logName' => 'YiiApp' 'logFacility' => LOG_USER
Last, the mapping i've done between Yii and Unix log levels is the following:
Yii - Unix ---------------------- trace - LOG_DEBUG info - LOG_INFO profile - LOG_NOTICE warning - LOG_WARNING error - LOG_ERR