• Edit
  • Delete

symfony logging cheatsheet

http://symfony.com/legacy/doc/gentle-introduction/1_4/en/16-Application-Management-Tools#chapter_16_sub_symfony_logs

Log levels: emerg, alert, crit, err, warning, notice, info, and debug

Set log level:

  • frontend/config/factories.yml
    • dev:
        logger:
          param:
            level: err

Log from anywhere:

  • ullCoreTools::sfLog($level, $message)

View log

  • ksystemlog
    • apt-get install ksystemlog
    • Provides good and simple filter option
  • Or on the command line
    • tail -f log/frontend_dev.log | grep xyz

Log in the production environment

http://blog.jetienne.com/2009/05/symfony-and-log-in-prod.html

settings.yml

  • prod:
      .settings:
        logging_enabled:        on

factories.yml

  • prod:
      logger:
        class:   sfFileLogger
        param:
          level:   err
          loggers: ~
          file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
    

Enable MySQL binary log

  • sudo vi /etc/mysql/my.cnf
    • Uncomment line starting with "log_bin"
  • sudo /etc/init.d/mysql restart

View log:

  • mysqlbinlog /var/log/mysql/mysql-bin.000001