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
I would like to offer an alternative and that is to set environment variables to change these directories. This way it's easier to set depending on the stage. (testing, production or development)
export SYMFONY__KERNEL__CACHE_DIR "/your/directory/cache"
export SYMFONY__KERNEL__LOGS_DIR "/your/directory/logs"
Environment variables can also be set in the virtual host with SetEnv. When reading kernel parameters symfony will look for all the $_SERVER variables that start with SYMFONY__, strip the first part and convert all the double underscores into a .
Source code
See line 568 to 608