Yii 1.1: flushablelogrouter

Processes logs every n entries
3 followers

By default logs are only processed at the end of a request. FlushableLogRouter will process the logs as soon as they are flushed. Additionally it will take care of emptying the logs of each route.

Requirements

Tested with Yii 1.1.6, but should also work with older versions.

Usage

Save the class file to your components folder and configure your application's log component to use this class. The example below will process logs every 10 entries.

'log' => array(
  'class'     => 'FlushableLogRouter',
  'autoFlush' => 10,
  'routes'    => array(...)
)

Note

This component changes the $autoFlush property of CLogger.

Total 2 comments

#4229 report it
Joblo at 2011/06/17 06:05am
Logging twice

I have to log inside a loop about 2000 times. So I decided to install the FlushableLogRouter flushing every 10 step. But then, every message is logged twice.

What can be the reason for this issue?

#3735 report it
Roland Csibrei at 2011/05/03 09:45am
CLogRoute and memory allocation problems

This extension solves the memory allocation problems when using Yii::log thousand times in one request. And also solves this "issue": http://code.google.com/p/yii/issues/detail?id=1832

Thanks, very useful...

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: ciss
  • Category: Logging
  • Votes: +2
  • Downloaded: 310 times
  • Created on: Mar 5, 2011
  • Last updated: Mar 5, 2011