Changing cache_dir and log_dir with Symfony2

前端 未结 7 2001
感动是毒
感动是毒 2021-02-19 13:50

Because of deployment constraints, I would like to have the log and cache directories used by my Symfony2 application somewhere under /var/... in my file system. For this reason

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-19 14:32

    Add the following methods to app/AppKernel.php (AppKernel extends Kernel) making them return your preferred paths:

    public function getCacheDir()
    {
        return $this->rootDir . '/my_cache/' . $this->environment;
    }
    
    public function getLogDir()
    {
        return $this->rootDir . '/my_logs';
    }
    

提交回复
热议问题