How can I access CakePHP log files on Heroku?

后端 未结 3 1161
挽巷
挽巷 2021-01-14 18:14

I\'ve deployed a CakePHP application to Heroku. CakePHP writes its logs in APP_ROOT/app/tmp/logs/error.log and APP_ROOT/app/tmp/logs/debug.log by d

3条回答
  •  感情败类
    2021-01-14 18:37

    In the latest versions of CakePHP (>= 3.6.0), the config/app.php file comes pre-configured to use an environment variable override for the stock debug and error logs. These vars should contain a DSN-style string defining the same attributes you would normally place in your config/app.php file.

    In the Heroku dashboard under Settings (or via the heroku cli tool), you can add the following ENV vars:

    LOG_DEBUG_URL = file:///?className=Cake%5CLog%5CEngine%5CConsoleLog&levels[]=notice&levels[]=info&levels[]=debug
    LOG_ERROR_URL = file:///?className=Cake%5CLog%5CEngine%5CConsoleLog&levels[]=warning&levels[]=error&levels[]=critical&levels[]=alert&levels[]=emergency
    

    The above two lines replicate the stock CakePHP logging, but redirect all output to the console instead of files.

提交回复
热议问题