====== 46 Laravel log ====== 下記のような感じで、constructにLogを使ってみた。 そうするとconstructにLogを利用すると、他のコマンドでもログが出力されてしまう。。。(^^; public function __construct() { parent::__construct(); try{ $this->class = basename(strtr(get_class($this), '\\', '/')); $this->mess_head = $this->class; Log::info($this->mess_head." START "); }catch(Exception $e){ echo $e->getMessage(); } } public function __destruct() { Log::info($this->mess_head." END send:$this->count"); } app/Http/Kernel.phpとapp/Console/Kernel.php のbootstrappers に Illuminate\Foundation\Bootstrap\ConfigureLoggingの呼び出しがあり、共通のインスタンスが利用されているため。 {{tag>Laravel}}