LogViewer icon indicating copy to clipboard operation
LogViewer copied to clipboard

Log [] is not defined. Unable to create configured logger. Using emergency logger.

Open akampour21 opened this issue 8 years ago • 16 comments

  • LogViewer Version: 4.5
  • Laravel Version: 5.6.3
  • PHP Version: 7.1.3

Description:

Hi,

I did all the steps needed to install and use logviewer but when I go to http://{myproject}/log-viewer what I get is an error

laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /var/www/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)
[stacktrace]
#0 /var/www/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(115): Illuminate\\Log\\LogManager->resolve(NULL)
#1 /var/www/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(103): Illuminate\\Log\\LogManager->get(NULL)
#2 /var/www/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(572): Illuminate\\Log\\LogManager->driver()
#3 /var/www/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php(270): Illuminate\\Log\\LogManager->__call('listen', Array)
#4 /var/www/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(61): Barryvdh\\Debugbar\\LaravelDebugbar->boot()
#5 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#6 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#7 /var/www/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#8 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#9 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#11 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#12 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#13 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#15 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#24 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#25 /var/www/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#26 {main}
"}

My question is, is it not supported for Laravel Version: 5.6.3 ? I added APP_LOG=daily LOG_CHANNEL=daily in my .env file and Arcanedev\LogViewer\LogViewerServiceProvider::class on my app.php service provider section.

Thank you for your time.

akampour21 avatar Feb 21 '18 14:02 akampour21

I think your issue is unrelated to this package.

You can be sure it works by creating a fresh project and installing only the logviewer package.

If you get the same issue, please describe it with steps to reproduce it.

Thanks for using this package :+1:

arcanedev-maroc avatar Feb 21 '18 15:02 arcanedev-maroc

Try to update your laravel project to 5.6.4 and see if it solves your issue.

arcanedev-maroc avatar Feb 21 '18 16:02 arcanedev-maroc

No, I'm afraid it doesn't. When I run php artisan log-viewer:check I still get these errors, although I updated my .env file to daily mode.

| Application requirements | | Status | Message |

| failed | You should set the log handler to daily mode. Please check the LogViewer wiki page (Requirements) for more details. |

| LogViewer messages |

| File | Message |

| laravel.log | You have a single log file in your application, you should split the [laravel.log] into seperate log files. |

akampour21 avatar Feb 21 '18 16:02 akampour21

OK, i see the issue.

You're not using the daily channel for your log system.

Edit the .env file: LOG_CHANNEL=daily

You can delete the single log file because it's not supported by the package: storage/log/laravel.log

Check my comment for more details about the usage: https://github.com/ARCANEDEV/LogViewer/issues/195#issuecomment-367388830

arcanedev-maroc avatar Feb 21 '18 16:02 arcanedev-maroc

I had that LOG_CHANNEL=daily on my .env file but still.. Should that be defined on my config/app.php file too?

akampour21 avatar Feb 21 '18 17:02 akampour21

If you're using Laravel 5.6, you need to update your config files if you've migrated from an older laravel version.

With laravel 5.6, the logging system has a dedicated file now: https://github.com/laravel/laravel/blob/master/config/logging.php

Just the .env file will do the job.

arcanedev-maroc avatar Feb 21 '18 17:02 arcanedev-maroc

That was the issue. Thank you.

akampour21 avatar Feb 21 '18 17:02 akampour21

You're welcome. Thanks for using the package :+1:

arcanedev-maroc avatar Feb 21 '18 17:02 arcanedev-maroc

I had the same issue with the error in my laravel.log file. And the adding logging.php config fixed it. But I still have a question. I developed my Laravel app from scratch and it based on Laravel 5.6.5. And I didn't have this config file in my file structure until I had added it manually... Why??? When did this file apper in Laravel app's file structure?

Pashaster12 avatar Jun 14 '18 12:06 Pashaster12

Hi @Pashaster12,

the official documentation may helps you to see all the major changes made from laravel 5.5 to 5.6.

If you've any laravel related questions, ask the forums [Laracasts] !!

arcanedev-maroc avatar Jun 14 '18 21:06 arcanedev-maroc

If you're using Laravel 5.6, you need to update your config files if you've migrated from an older laravel version.

With laravel 5.6, the logging system has a dedicated file now: https://github.com/laravel/laravel/blob/master/config/logging.php

Just the .env file will do the job.

That worked for me as soon as I copied the loggin.php file in the config directory. I recently did a compooser update

thobishi avatar Oct 28 '18 19:10 thobishi

I copied the loggin.php file in the config directory. now, it's work.

day112 avatar Nov 15 '18 06:11 day112

@arcanedev-maroc, work for me. Thanks. I have been update from Laravel 5.4. to 5.8

dobrydev avatar May 07 '19 09:05 dobrydev

Solution:

cd config && wget https://raw.githubusercontent.com/laravel/laravel/master/config/logging.php

tiagofrancafernandes avatar Oct 20 '21 20:10 tiagofrancafernandes

I copied the loggin.php file in the config directory. now, it's work.

john-julius avatar Feb 28 '22 20:02 john-julius