Error with Logger and /web/assets

I put together a simple API that only returns JSON objects. I’ve removed all stylesheets, bootstrap, and view files. The controllers return the JSON objects directly.

When an error was encountered I would get this error:


Unable to send log via yii\debug\LogTarget: Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'The directory is not writable by the Web process: /var/www/html/api/web/assets'

Here is the full stack trace: http://pastebin.com/VZTjy5BM

When I created the "assets" directory and gave the web server write access the error went away. The log then displayed the real error. I looked into the new "assets" directory and found it was empty.

I’m curious as to why the “assests” directory is required for error logging? Is there a way to remove that dependency?

It’s required for debug panel ‘yii2-debug’, but not error logging. You can prevent loading it before processing request, just remove ‘debug’ from bootstrap in main-local.php




    'bootstrap' => ['debug'],

    'modules' => [

        'debug' => [

            'class' => 'yii\debug\Module',

            'allowedIPs' => [

                '127.0.0.1', '::1',

            ],

            'on beforeAction' => function(){

                \Yii::$app->response->format = 'html';

            },

        ],

        'gii' => [

            'class' => 'yii\gii\Module',

            'allowedIPs' => [

                '127.0.0.1', '::1',

            ],

            'on beforeAction' => function(){

                \Yii::$app->response->format = 'html';

            },

        ],

    ],



Thank you!