How can I access CakePHP log files on Heroku?

后端 未结 3 1179
挽巷
挽巷 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:55

    I think the following might work. Make sure you're using CakePHP 2.3.9.

    App::uses('ConsoleOutput', 'Console');
    
    CakeLog::config('default', array(
        'engine' => 'ConsoleLog',
        'stream' => new ConsoleOutput('php://stdout')
    ));
    
    CakeLog::config('stdout', array(
        'engine' => 'ConsoleLog',
        'types' => array('notice', 'info'),
        'stream' => new ConsoleOutput('php://stdout')
    ));
    
    CakeLog::config('stderr', array(
        'engine' => 'ConsoleLog',
        'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'),
        'stream' =>  new ConsoleOutput('php://stderr')
    ));
    
    
    CakeLog::config('debug', array(
        'engine' => 'ConsoleLog',
        'types' => array('notice', 'info', 'debug'),
        'format' => 'debug %s: %s',
        'stream' => new ConsoleOutput('php://stdout')
    ));
    
    CakeLog::config('error', array(
        'engine' => 'ConsoleLog',
        'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
        'format' => 'error %s: %s',
        'stream' =>  new ConsoleOutput('php://stderr')
    ));
    

提交回复
热议问题