syslogroute Route Yii log messages directly to syslog / Windows Event Log

  1. Documentation
  2. Change Log

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 :)

Resources

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/extensions
Usage

In config/main.php:

'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

Change Log

September 9, 2009
  • Third release bugfix: case statement missing breaks, priorities in windows systems now behave normally. (thanks to Magomed)
July 6, 2009
  • Second release added initial support for windows platforms
June 25, 2009
  • Initial release.
4 0
4 followers
1 780 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Logging
Developed by: eval
Created on: Jun 24, 2009
Last updated: 7 years ago

Downloads

show all

Related Extensions