LoginSignup
3
1

More than 5 years have passed since last update.

CakePHP3メモ

Posted at

すぐ忘れてしまうものをメモっておきます。

デバッグログ

コントローラーでdebugログを出力したい場合です。$this->log();を使用します。

$this->log("This is debug log", "debug");

ログが app/logs/debug.logに書き込まれます。

書き込まれたログを確認
tail -f app/logs/debug.log 

2016-11-14 03:01:17 Debug: This is debug log

ログが出力されました。

変数を表示する場合は、$this->log();に変数を渡します。

$data = ["user_id" => 10];
$this->log($data , "debug");
書き込まれたログを確認
tail -f app/logs/debug.log 

2016-11-14 03:01:17 Debug: Array
(
    [user_id] => 10
)

debug.logに変数が表示されました。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1