php - Not able to see the log file in Yii

761

I am not able to see the log files in Yii framwork. By default it saves in "protected/runtime". Here is my config in main:

'log'=>array(
            'class'=>'CLoCFileLogRoutegRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning, info',
                    'categories'=>'system.*',
                ))),

and this is how I'm logging:

Yii::log("Index Checkout", "profile", 'system.web.CController');
Yii::trace('IndexCheckout', 'system.web.CController');

Not getting any error but can't find any log file.

Any idea ? Thanks.

661

Answer

Solution:

May be something wrong name with your log classCLoCFileLogRoutegRouter. It should beCLogRouter

'log' => array(
    'class' => 'CLogRouter',
        'routes' => array(
            array(
                'class' => 'CFileLogRoute',
                    'levels' => 'error, warning, info',
                    'categories'=>'system.*',
                ),
258

Answer

Solution:

Even though the question is already answered

Please consider that Yii writes logs after the main script is ended, So if you terminate your script using die() command, you never let Yii write it down. To avoid such problems you should terminate the script using Yii::app()->end() command.

For more information see here

996

Answer

Solution:

You are configuring your log to only log messages related to 'error, warning, and info',

And you are trying to Log, "trace" (Yii::trace) and "profile" levels, thats why you are not getting anything.

Also: dont try to log "profile" things on you own, there are specific methods for that, namely Yii::beginProfile() and Yii::endProfile, read more about profiling at the yii guide

715

Answer

Solution:

This is most likely a permissions problem. Is the runtime directory writable by your web server (Apache)?

People are also looking for solutions to the problem: need advice on mysql normalization and php class structure

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.