Yii Framework Forum: Can't Change Debug Trace Level. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't Change Debug Trace Level. Newbie difficulties

#1 User is offline   kalopsia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 05-February 14

Posted 26 March 2014 - 07:33 AM

Hello, my configuration file as follows:

'log' => [
            'traceLevel' => YII_DEBUG ? 1 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],


But my app.log and the web page itself looks like this:

2014/03/26 16:12:26 [192.168.10.1] [error] [yii\base\ErrorException] exception 'yii\base\ErrorException' with message 'Undefined variable: contentss' in /srv/yii2.com/views/layouts/clean.php:25
Stack trace:
#0 /srv/yii2.com/views/layouts/clean.php(25): yii\base\Application->handleError(8, 'Undefined varia...', '/srv/yii2.com/v...', 25, Array)
#1 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(292): require('/srv/yii2.com/v...')
#2 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(232): yii\base\View->renderPhpFile('/srv/yii2.com/v...', Array)
#3 /srv/yii2.com/vendor/yiisoft/yii2/yii/widgets/ContentDecorator.php(50): yii\base\View->renderFile('@app/views/layo...', Array)
#4 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Widget.php(73): yii\widgets\ContentDecorator->run()
#5 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(398): yii\base\Widget::end()
#6 /srv/yii2.com/views/layouts/main.php(239): yii\base\View->endContent()
#7 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(292): require('/srv/yii2.com/v...')
#8 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(232): yii\base\View->renderPhpFile('/srv/yii2.com/v...', Array)
#9 /srv/yii2.com/vendor/yiisoft/yii2/yii/widgets/ContentDecorator.php(50): yii\base\View->renderFile('@app/views/layo...', Array)
#10 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Widget.php(73): yii\widgets\ContentDecorator->run()
#11 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(398): yii\base\Widget::end()
#12 /srv/yii2.com/views/layouts/container.php(12): yii\base\View->endContent()
#13 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(292): require('/srv/yii2.com/v...')
#14 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(232): yii\base\View->renderPhpFile('/srv/yii2.com/v...', Array)
#15 /srv/yii2.com/vendor/yiisoft/yii2/yii/widgets/ContentDecorator.php(50): yii\base\View->renderFile('@app/views/layo...', Array)
#16 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Widget.php(73): yii\widgets\ContentDecorator->run()
#17 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(398): yii\base\Widget::end()
#18 /srv/yii2.com/views/layouts/left-column.php(10): yii\base\View->endContent()
#19 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(292): require('/srv/yii2.com/v...')
#20 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/View.php(232): yii\base\View->renderPhpFile('/srv/yii2.com/v...', Array)
#21 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Controller.php(296): yii\base\View->renderFile('/srv/yii2.com/v...', Array, Object(app\controllers\PostsController))
#22 /srv/yii2.com/controllers/PostsController.php(41): yii\base\Controller->render('index', Array)
#23 [internal function]: app\controllers\PostsController->actionIndex()
#24 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/InlineAction.php(53): call_user_func_array(Array, Array)
#25 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Controller.php(128): yii\base\InlineAction->runWithParams(Array)
#26 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Module.php(586): yii\base\Controller->runAction('', Array)
#27 /srv/yii2.com/vendor/yiisoft/yii2/yii/web/Application.php(85): yii\base\Module->runAction('posts', Array)
#28 /srv/yii2.com/vendor/yiisoft/yii2/yii/base/Application.php(289): yii\web\Application->handleRequest(Object(yii\web\Request))
#29 /srv/yii2.com/www/index.php(13): yii\base\Application->run()
#30 {main}
...


Attached File  log_yii.png (87.04K)
Number of downloads: 0

May be I confuse something.., but is 'traceLevel' parameter responsible for the number of outputs above?
I want to get a little bit less detailed information. Is it possible?
0

#2 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 534
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 26 March 2014 - 08:20 AM

tracelevel is for normal log messages to see where they come from. For Exceptions there is always the full stack trace to allow debugging the cause. It makes no sense to truncate the trace in this case.
0

#3 User is offline   kalopsia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 05-February 14

Posted 26 March 2014 - 10:43 AM

Thank you Carsten for explanation. Could you tell me what 'traceLevel' is responsible for? I'm a little bit confused)
0

#4 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 534
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 26 March 2014 - 11:05 AM

traceLevel sets the number of trace items to add under a log message that is logged when you call Yii::info() Yii::warning() or Yii::error().
0

#5 User is offline   kalopsia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 05-February 14

Posted 26 March 2014 - 11:52 AM

I've read yii\BaseYii class reference, but didn't understand what Yii::info(), Yii::warning() and Yii::error() do excatly and what are they need for?
May be you give us a little "realworld" example? :rolleyes:
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users