Changing cache_dir and log_dir with Symfony2 Changing cache_dir and log_dir with Symfony2 symfony symfony

Changing cache_dir and log_dir with Symfony2


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';}


I was happy to find your post, but I was a little bit confused of the unhelping answers.

I got the same problem and found out that the logs are depending on the config parameter kernel.logs_dir.

So I just added it to my config.yml parameters:

kernel.logs_dir: /var/log/symfonyLogs

I hope it will helpfull for you even, if its a late answer.


i think the easiest way is to link the folder to another place. We have made this on the prod server but when you develop local perhaps on windows its a bit complicated to set the symlinks.

ln -s /var/cache/ /var/www/project/app/cache

something like this.