katzgrau/KLogger

can't stdout and log on file at same time

Closed this issue · 2 comments

I'm using this:

    $GLOBALS['logger'] = new Katzgrau\KLogger\Logger(
        'php://stdout',
        Psr\Log\LogLevel::DEBUG, array(
            'extension' => 'log', // changes the log file extension
            'filename' => basename(__FILE__, '.php'),
            'logFormat' => "[{date}][{level}]\t{message}",
        )
    );

    $GLOBALS['logger']->setLogFilePath(__DIR__ . '/logs');

But for some reason, it's only logging on stdout and not saving on file
Any tip?

The file opened for writing here would be php://stdout/[filename] so it's likely just going to stdout. Writing to stdout and a file at the same time isn't a supported feature. But you could probably extend the class to do so.

thanks