Coder Social home page Coder Social logo

Comments (4)

mdeletrez avatar mdeletrez commented on July 20, 2024

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;
        }

from monolog-cascade.

rantonmattei avatar rantonmattei commented on July 20, 2024

So, I'm not sure I follow. Do you need any help?

from monolog-cascade.

glensc avatar glensc commented on July 20, 2024

@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.

from monolog-cascade.

glensc avatar glensc commented on July 20, 2024

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

from monolog-cascade.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.