Call for urgent help: Yii::log has no output

This is my log config:




                // Preloading 'log' component

                'preload'=>array('log'),

                // Application components

                'components' => array(

                    // Application Log

                    'log'=>array(

                        'class'=>'CLogRouter',

                        'routes'=>array(

                        // Save log messages on file

                            array(

                                    'class'=>'CFileLogRoute',

                                    'levels'=>'error, warning, trace, info',

                            ),

                        ),

                    ),

                ),



and in my commands class:




class MyconsoleCommand extends CConsoleCommand {

          public function run($args){

                 .......

                 echo "+++++++++++++\n";

                 Yii::log('MyconsoleCommand logging....');

                 //also tried following, but no result

                 //Yii::log('MyconsoleCommand logging....', 'info');

                 echo "+++++++++++++\n";

                 .......

          }

}



i can only see the two lines of "+++++++++++++" on the screen without any error. but in my runtime directory, the application.log has no change.

anywhere i did wrongly? thanks so much for the help!

Make sure your runtime directory has write permissions. Also make sure you are editing console’s config file, not main.php :)

Also check that the application runs in debug mode

Thanks for the prompt response. Both my runtime and application.log permission is 757. I can get the log updated only if there is really a code error. I am running my script with the command




php entry.php myconsole



and i also have this line in my entry.php




defined('YII_DEBUG') or define('YII_DEBUG',true);



is it because i am running in the command mode, so i can’t write into the log file?

Now I run it on my local pc, and realized only when there is application error generated, the log message which I purposely put will also be written into the log file. But it won’t get updated if there is no application error occurred. Why is it so? How can I make my trace message written into the log file???

Anybody encounter this problem before?

Can you explain what you mean by "purposely put" ?

If you mean Yii’s internal trace messages: Check that you don’t use yiilite.php. It has the Yii::trace() calls stripped off.

What about the processLogs() fix in Yii 1.1.4?

http://code.google.com/p/yii/issues/detail?id=1493

/Tommy