Force message routing before the end of the Application

Is there a way to force the log routing before the end of the application?

I was searching the Yii code and I found the property $autoFlush = 10000 in the CLogger component. I setted manualy the value to 1 in the class and it worked.

But how do i set this value from outside?

How do i access the current instance of the class?

I tried to set the value declaring it in the app config:

   [i] 'logger'=>array(




but it dispatches an error:

[i]exception ‘CException’ with message ‘CLogger does not have a method named “init”.’ in /home/.../projetos/testeDaniel/PMSYii/framework/base/CComponent.php:237

Stack trace:

#0 [internal function]: CComponent->__call(‘init’, Array)

#1 /home/.../projetos/testeDaniel/PMSYii/framework/base/CModule.php(352): CLogger->init()

#2 /home/.../projetos/testeDaniel/PMSYii/framework/base/CModule.php(440): CModule->getComponent(‘logger’)

#3 /home/.../projetos/testeDaniel/PMSYii/framework/base/CApplication.php(119): CModule->preloadComponents()

#4 /home/…/projetos/testeDaniel/PMSYii/framework/YiiBase.php(112): CApplication->__construct(’/home/…’)

#5 /home/…/projetos/testeDaniel/PMSYii/framework/YiiBase.php(99): YiiBase::createApplication(‘CConsoleApplica…’, ‘/home/…’)

#6 /home/…/projetos/testeDaniel/PMSYii/PMSConsole.php(13): YiiBase::createConsoleApplication(’/home/…’)

#7 {main}[PMSYii]$ php PMSConsole.php startreadingengine[/i]

Any sugestions?

CLogger is no ApplicationComponent, that’s why you can’t set it in the components array.

At this time, there’s obviously no way to use a custom logger class or the possibility to set $autoFlush in the config.

However, you can put this on top of your config:


Yii::getLogger()->autoFlush = 0;

return array(

   // the actual application config goes here




Now that I know how to access the Clogger class im using: Yii::getLogger()->flush();

Could you try with my issue? I’ve tried with both approach with no luck.