leafsphp / logger

📂 Logging for leaf php
https://leafphp.dev/modules/logger/
2 stars 2 forks source link

Unable to get errors as a log file #2

Closed keskinonur closed 1 year ago

keskinonur commented 1 year ago

Hi, I would like to get error's in my log file. Although I can display the logs in error details page, these log are not recorded as file. File is created but it is just empty.

In my index file, the configuration and log start is like this:

app()->config([
    'log.enabled' => true,
    'log.level' => \Leaf\Log::DEBUG,
    'log.dir' => __DIR__ . "/../logs/",
    'log.file' => 'leaf_' . date('Ymd') . '.log',
    'log.style' => 'linux',
    'log.open' => true,
    'log.writer' => null,
    'debug' => false, // If I make this true, then visitors may see the errors, which is nobody wants in prod 😄 
]);

// some other parts ...

app()->logger()->enabled(true);

// rest of the script ...

Do you have any suggestion?

BTW: I am using PHP 8.1.2 with leafs/logger version 1.2 via composer

mychidarko commented 1 year ago

Hi @keskinonur I'm just seeing this issue. I'm not really sure what could be going on, but could you try this and see if that is logged in your file:

app()->logger()->error("Just a test");
mychidarko commented 1 year ago

Hi @keskinonur, just checking in on this issue

mychidarko commented 1 year ago

Do you still have this issue?

mychidarko commented 1 year ago

Closing due to inactivity