Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monolog-cascade doesn't create log folders and file #87

Open
RecanN opened this issue Nov 25, 2018 · 2 comments
Open

monolog-cascade doesn't create log folders and file #87

RecanN opened this issue Nov 25, 2018 · 2 comments

Comments

@RecanN
Copy link

RecanN commented Nov 25, 2018

Monolog-Cascade does not create the log folder nor the log files while I configured and installed as described in the documentation. it seems to me that Handlers and Streams do not work using the conf.yaml file
Exmple with Monlog-cascade:

object(Monolog\Logger)#22 (5) {
  ["name":protected]=>
  string(16) "import"
  ["handlers":protected]=>
  array(0) {
  }
  ["processors":protected]=>
  array(0) {
  }
  ["microsecondTimestamps":protected]=>
  bool(true)
  ["exceptionHandler":protected]=>
  NULL
}

Exemple without Monolog-cascade ( using Monolog pushHandler and streamHandler )

object(Monolog\Logger)#22 (5) {
  ["name":protected]=>
  string(16) "import"
  ["handlers":protected]=>
  array(1) {
    [0]=>
    object(Monolog\Handler\StreamHandler)#49 (10) {
      ["stream":protected]=>
      NULL
      ["url":protected]=>
      string(36) "../../../../log/import.log"
      ["errorMessage":"Monolog\Handler\StreamHandler":private]=>
      NULL
      ["filePermission":protected]=>
      NULL
      ["useLocking":protected]=>
      bool(false)
      ["dirCreated":"Monolog\Handler\StreamHandler":private]=>
      NULL
      ["level":protected]=>
      int(100)
      ["bubble":protected]=>
      bool(true)
      ["formatter":protected]=>
      NULL
      ["processors":protected]=>
      array(0) {
      }
    }
  }
  ["processors":protected]=>
  array(0) {
  }
  ["microsecondTimestamps":protected]=>
  bool(true)
  ["exceptionHandler":protected]=>
  NULL
}

My conf.yaml:

formatters:
    dashed:
        class: Monolog\Formatter\LineFormatter
        format: "%datetime%-%channel%.%level_name% - %message%\n"

handlers:
    default:
        class: Monolog\Handler\StreamHandler
        level: DEBUG
        formatter: dashed
        stream: D:\TheProject\log\default.log
    import:
        class: Monolog\Handler\StreamHandler
        level: DEBUG
        formatter: dashed
        stream:  D:\TheProject\log\import.log

loggers:
    myLogger:
        handlers: [default,import]

Did I miss something ?

@DBX12
Copy link
Contributor

DBX12 commented Jan 16, 2019

It might seem trivial, but did you load the config file with Cascade::fileConfig("/path/to/conf.yml")?

@johnlangfy
Copy link

I was getting this same issue until I changed the following mismatched strings to match each other:
Cascade::getLogger('MISMATCHED_STRING');

to match the one here:

loggers:
  MISMATCHED_STRING:
    handlers: [default,import]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants