Clearing file cache using the Symfony cache:clear command¶
Symfony provides a command for clearing cache. It will delete all file-based caches, which mainly consist of Twig template, Symfony container, and Symfony route cache, but also everything else stored in the cache folder. Out of the box on a single-server setup this includes Content cache. For further information on the command's use, see its help text:
php app/console --env=prod cache:clear -h
If you do not specify an environment, by default
cache:clear will clear the cache for the
dev environment. If you want to clear it for
prod you need to use the
In clustering setup (with several web servers), the command to clear file cache needs to be executed on every web server.
Clearing Content cache on a cluster setup¶
For a cluster setup, the Content cache (HTTP cache and Persistence cache) must be set up to be shared among the servers. And while all relevant cache is cleared for you on Repository changes when using the APIs, there might be times where you'll need to clear cache manually:
Web Debug Toolbar¶
When running eZ Platform in the
dev environment you have access to the standard Symfony Web Debug Toolbar. It is extended with some eZ Platform-specific information:
Here you can see the name of the current SiteAccess and how it was matched. For reference see the list of possible SiteAccess matchers.
Logging and debug configuration¶
Logging in eZ Platform consists of two parts. One are several debug systems that integrate with Symfony developer toolbar to give you detailed information about what is going on. The other is the standard PSR-3 logger, as provided by Symfony using Monolog.
Debugging in dev environment¶
Reducing memory use¶
For long-running scripts, see Executing long-running console commands.
If you are running out of memory and don't need to keep track of cache hits and misses, you can disable StashBundle tracking, represented by the
stash.tracking setting, and persistence cache logging, represented by the setting
1 2 3 4 5 6 7 8 9 10
stash: tracking: false # Default is true in dev tracking_values: false # Default is false in dev, to only track cache keys not values caches: default: inMemory: false # Default is true, but this uses a lot of PHP memory registerDoctrineAdapter: false parameters: ezpublish.spi.persistence.cache.persistenceLogger.enableCallLogging: false
Error logging and rotation¶
eZ Platform uses the Monolog component to log errors, and it has a
RotatingFileHandler that allows for file rotation.
According to their documentation, it "logs records to a file and creates one logfile per day. It will also delete files older than
Monolog's handler can be configured in
1 2 3 4 5 6 7
monolog: handlers: main: type: rotating_file max_files: 10 path: '%kernel.logs_dir%/%kernel.environment%.log' level: debug
Monolog themselves recommend using
logrotate instead of doing the rotation in the handler, because it gives better performance.