Introduction

Logging in eZ Platform consists of two parts, several debug systems that integrates with symfony developer toolbar to give you detailed information about what is going on. And standard PSR-3 logger, as provided by Symfony using Monolog.

Debugging in dev environment

When using the Symfony dev environment, the system out of the box tracks additional metrics for you to be able to debug issues, this includes Stash cache use (done by StashBundle), and a persistence cache use.

Reducing memory use

For long running scripts, instead head over to How to run long-running console commands for some much more relevant info.

If you are running out of memory and don't need to keep track of cache hits and misses. Then StashBundle tracking, represented by the stash.tracking setting, and persistence cache logging, represented by the setting parameters.ezpublish.spi.persistence.cache.persistenceLogger.enableCallLogging, can optionally be disabled.

 

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
            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 $maxFiles".

But then, their own recommendation is to use "logrotate" instead of doing the rotation in the handler as you would have better performance.

 

More details here:

 

If you decided to use Monolog's handler, it can be configured in app/config/config.yml

monolog:
    handlers:
        main:
            type: rotating_file
            max_files: 10
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug