LoginSignup
0
0

More than 5 years have passed since last update.

FatalThrowableError in ConfigureLogging.php

Last updated at Posted at 2018-12-19

とある既存プロジェクトの環境構築にて

 これは Laravel 5.1 導入時のエラーです。5.2, 5.3 も同じく出ると思います。検索からこのページにたどり着いた人は正解がここに記載されていますのでご熟読ください。

 年末も差し迫ったある日「Vagrant boxあるのでよろしく」と引き継いでようやくたどり着いたLaravelの画面ですが、いきなりエラーです。なかなか解答にたどり着けなかったのでここにポストしておきます。

FatalThrowableError in ConfigureLogging.php line 59:
Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler()
in ConfigureLogging.php line 59
at ConfigureLogging->configureHandlers(object(Application), object(Writer)) in ConfigureLogging.php line 29
at ConfigureLogging->bootstrap(object(Application)) in Application.php line 203
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 222
at Kernel->bootstrap() in Kernel.php line 117
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 53

原因は、 config/app.php の log パラメータでした。'daily'にして動作確認したらビンゴでした。

    'log' => 'daily',
    //'log' => env('APP_LOG', 'daily'),

env関数はphpdotenvというライブラリを使用して .env ファイルを読みに行きくとのことで設定されていた値は何もありません。

APP_LOG=

んー
エラーを吐いたコアの関数を眺めてると

    /**
     * Configure the Monolog handlers for the application.
     *
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @param  \Illuminate\Log\Writer  $log
     * @return void
     */
    protected function configureHandlers(Application $app, Writer $log)
    {
        $method = 'configure'.ucfirst($app['config']['app.log']).'Handler';

        $this->{$method}($app, $log);
    }

はあ、 'configureHandler'という文字列を作ってそのメソッドを呼び出そうとしてました。
それは例外出るでしょーと後から納得。とりあえず'daily'で存在するメソッド呼びましょう。

あー、ソースコード修正じゃなくて .env に daily 設定の方がいいですね。こちらでも動作確認OKということで無事解決。

APP_LOG=daily

そこそこタイムロスでした。

0
0
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
0
0