I am using symfony 4.1 and monolog 3.3.
I have my symfony project in the following directory: /var/www/html/{project_dir}
.
In production environment I want my logs to be stored inside /tmp/foo
instead of standard symfony directory: {project_dir_path}/var/log
.
I changed Kernel::getLogDir()
method to the following:
public function getLogDir()
{
return 'prod' === $this->environment
? '/tmp/foo'
: $this->getProjectDir().'/var/log';
}
My production monolog.yaml
path looks like this:
path: "%kernel.logs_dir%/%kernel.environment%.log"
My environment for testing issues is set to 'prod'.
When I am debugging, I can see that monolog's log directory is correctly set to /tmp/foo
. /tmp/foo
has proper access rights (0766) but when I try to log something, the directory contains nothing.
php $fullVerifiedPath = getcwd();
– BlackXero/tmp/foo
. – RaspberryJam