Closed mdeletrez closed 8 years ago
sorry i make a mistake about name of my file xxxx.yaml whereas the extension was xxx.yml
so your test file_exists doesn't work ... i should put it in my code :
try {
$path = APPLICATION_PATH . '/configs/monolog/cascade/testcontroller.yml';
//echo $path."\n";
if (!file_exists($path)) {
throw new Exception('file not exists : '.$path);
}
Cascade::fileConfig($path);
Cascade::getLogger('myApp')->info('Well, that works!');
Cascade::getLogger('myApp')->error('Maybe not...');
} catch (Exception $e) {
echo $e;
}
So, I'm not sure I follow. Do you need any help?
@rantonmattei he says that your Cascade::fileConfig($path);
does not check that file does not exist and proceeds with uncertain error message that does not give any hint what was wrong.
run this example:
<?php
use Cascade\Cascade;
require 'vendor/autoload.php';
Cascade::fileConfig('no-such-file-anywhere');
and you get:
$ php test.php
PHP Warning: Illegal string offset 'disable_existing_loggers' in monolog-cascade/src/Config.php on line 99
PHP Stack trace:
PHP 1. {main}() monolog-cascade/test.php:0
PHP 2. Cascade\Cascade::fileConfig() monolog-cascade/test.php:7
PHP 3. Cascade\Config->configure() monolog-cascade/src/Cascade.php:112
PHP Warning: Illegal string offset 'disable_existing_loggers' in monolog-cascade/src/Config.php on line 102
PHP Stack trace:
PHP 1. {main}() monolog-cascade/test.php:0
PHP 2. Cascade\Cascade::fileConfig() monolog-cascade/test.php:7
PHP 3. Cascade\Config->configure() monolog-cascade/src/Cascade.php:112
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Cannot configure loggers. No logger configuration options provided.' in monolog-cascade/src/Config.php:121
Stack trace:
#0 monolog-cascade/src/Cascade.php(112): Cascade\Config->configure()
#1 monolog-cascade/test.php(7): Cascade\Cascade::fileConfig('no-such-file-an...')
#2 {main}
thrown in monolog-cascade/src/Config.php on line 121
Illegal string offset 'disable_existing_loggers' in vendor/theorchard/monolog-cascade/src/Config.php:99
$this->options seems to be a string having the path of the config file