Laravel 5.6 Upgrade caused Logging to break - php

Heey!
So I've recently been given the task to take a Laravel 5.2 up to 5.6. It seemed to be fine...until I tried to do a \Log::info(). Every time I run that, I get a big error, but at the end, it still prints to the log. I saw the 5.6 documentation on creating the config/logger.php. I took a fresh copy of it from github. The only thing I did after that was set an env variable for the LOG_CHANNEL to be single. Here's the error I get:
[2018-03-02 08:28:59] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at I:\xampp\htdocs\mtm\vendor\laravel\framework\src\Illuminate\Log\LogManager.php:181)
[ ....
I did a file comparison between Laravel 5.2 and 5.6. I'm not seeing anything that jumps out that would break the Logging functionality.
Has anyone run into this with a Laravel upgrade?

Add this file to your config folder
https://github.com/laravel/laravel/blob/5.6/config/logging.php
and add this to your .env file LOG_CHANNEL=stack
Don't forget to run php artisan config:clear command afterwards.

I was facing the same issue due to upgrade of my laravel version from 5.3 to 5.7. But after search of few mints i found the solution.
You just need to follow the following steps.
create logging.php file inside the config folder.
Copy code from this Official Link of Laravel.
Past this code into your logging.php file.
run this command -- php artisan config:clear
All done. Happy Coding :)

I got the same problem and tried to do everything as you did but not work.
Finally, I've found that it was because of cached config, just clear it and everything will be fine:
php artisan config:clear

I recently had the same error in my development machine (and not in the production one, oddly). In my development machine I have both php 7.1 and php 7.2 installed. Checking with phpinfo(), I discovered that 7.1 was the default version, so I decided to switch to 7.2.
sudo a2dismod php7.1
sudo a2enmod php7.2
sudo systemctl restart apache2
That didn't solve the problem (but maybe was part of it).
After several hours spent on trying everything suggested around the web, I found my solution by:
Checking all the permissions in the storage folder.
In my project folder, clearing all the cache(s) and config(s).
Dumping all composer autoload files.
In detail:
cd your_project_full_path
sudo chmod -R 0775 storage
sudo chown -R www-data:www-data storage
php artisan config:clear
php artisan view:clear
php artisan route:clear
composer dump-autoload
After this, I had no problem any more. Maybe try 0755 as permission for the storage folder. Hope this helps!

use upgrade guide , and add logging.php to your config files.

After two days of some research, I found a solution on Github.
If you are using Laravel 5.5.4 to Laravel 5.6.*, then you can just install and configure the exceptions package by Graham Campbell.
Link: https://github.com/GrahamCampbell/Laravel-Exceptions
This worked perfectly for me on Mac OSX (PHP 7.1.7), Laravel 5.6.22
My initial error:
2018-05-25 14:35:07] laravel.EMERGENCY: Unable to create configured logger.
Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /Users/pro/Sites/metiwave/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)

In my case, APP_LOG= was blank in .env file so I saved it as APP_LOG=single and it worked.

I had the same issue, turns out I had accidentally moved the config folder. If you find yourself in the same situation, (probably as embarrassed as I am) move it back to the root folder of your project.
Regards

all right, i got it
take a look at the official library, copy log config configuration code :
link :https://github.com/laravel/laravel/blob/5.6/config/logging.php
create in your project's config directory logging.php file
copy the code in
clear the cache :php artisan config:clear
that's it. keep stomping ...

Related

Laravel with App Engine Standard Class 'Facade\Ignition\IgnitionServiceProvider' not found

This is driving me crazy second day. I'm new to Laravel and trying to get Laravel 6 work on Google App Engine Standard.
Tried: This tutorial and other ones, but it still fails to load Laravel index page
What I have done:
Created new Laravel project
Checked that Laravel is working on local host with php artisan serve
Generated new key with php artisan key:generate --show
Created app.yaml file with:
runtime: php72
env_variables:
APP_KEY: iktbUa2quYPV2av3zDx0XAuEVjwzVQY/oMfyI2PQNKk=
APP_STORAGE: /tmp
VIEW_COMPILED_PATH: /tmp
SESSION_DRIVER: cookie
Modified bootstrap/app.php by adding $app->useStoragePath(env('APP_STORAGE', base_path() . '/storage'));
Rancomposer remove --dev beyondcode/laravel-dump-server
Also ran:
php artisan cache:clear,
php artisan route:cache,
php artisan config:clear,
php artisan view:clear (as other tutorials suggested)
And gcloud app deploy
And I get error: "Class 'Facade\Ignition\IgnitionServiceProvider' not found"
If you're facing this issue after upgrading composer 1.0 to 2.0. Then you can follow this step:
Go to the project directory
Run composer install
Run composer dump-autoload
Try to run php artisan serve
It solved for me
Please Try
composer dump-autoload
It solved for me
App engine install dependency with "--no-dev" flag. If your application is debug mode and there is an error application is try to render error page by "facade/ignition" packages.
Solve-1: You can move "facade/ignition" dependency from "require-dev" to "dev" in composer.json file
Solve-2: You can run as production environment and with false APP_DEBUG flag
I have experienced other errors as well, most of them gave me Error 500 and
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /tmp/google-config/nginx.conf:3 in Stackdriver Logger
Also I was not aware that App Engine was executing composer.json on build (see Specifying Dependencies). And it seems the issue was that it cached that.
Everything was resolved by replacing command in step 7. :
gcloud app deploy with gcloud beta app deploy --no-cache
It seems that if I would have done all steps as in tutorial from the start I would not have any issues.
Try
php artisan route:clear
and you're good to go.
I try
composer update
and its working fine
Try running
composer update
or
composer dump-autoload
Go to your project terminal and run :
composer install
composer dump-autoload
php artisan serve
And your problem will go away.
I am also new to Laravel and I have experienced with this issue, and I searched solution which was
first run this command on your terminal
composer update
second run the command on below
composer dump-autoload
and then see the result :)
just uncomment soduim line from your ini file
before
;extension=sodium
after
extension=sodium
If you are facing this issue while running phpUnit tests then try to clear cache of bootstrap folder.

Class 'App\Providers\AppServiceProvider' not found

I have changed my application by using command
php artisan app:name [app_name].
Then, when I try to perform other actions using following artisan commands,
php artisan down
php artisan up
php artisan config:cache
I got the following error:
PHP Fatal error: Class 'App\Providers\AppServiceProvider' not found
How can I solve it?
It is working after Clearing bootstrap/cache directory.
This is how its worked out for me in the case of a fresh install.
First, I cleared the files in boostrap\cache.
Then, in config\app.php, I added the below line in the providers,
\Laravel\Telescope\TelescopeServiceProvider::class,
Then I ran the below commands
php artisan telescope:install
php artisan migrate
And it was working after this.
I don't know for what reason the telescope provider didn't work which was added by Laravel itself. i.e App\Providers\TelescopeServiceProvider::class.
By the way my laravel version was 7.12.0.
In my case, some extension of the VSCode, added a use Illuminate\Support\Facades\App; at the beginning of the file /config/app.php.
I solved it by removing the line from the file and running composer install.
You might have deleted the folder called providers
App/providers.
I had a question like yours then I solved it by copying app/providers directory from another Laravel project to my project thus it worked
I had the same issue, I solved it by,
migrate migration file - vendor>laravel>telescope>database>- manually.
check app.php file, if App\Providers\TelescopeServiceProvider::class, exist or not, have to exist
Run in command shell>
npm run dev

Vendor:Publish - Nothing to publish for tag [] - Only on production server

I am using a third party library and locally, I installed everything using the steps that they provided.
I ran composer require on the package and ran an update. This installed into the vendor folder.
I then added the path into the provider in config/app and also as an aliases..
I ran php artisan vendor:publish --provider="Spatie\LaravelAnalytics\LaravelAnalyticsServiceProvider" the config file created successfully and I had no problems.
I then uploaded to the production environment and kept on getting Class 'LaravelAnalytics' not found and I can't seem to figure out the problem..
I ran php artisan vendor:publish --provider="Spatie\LaravelAnalytics\LaravelAnalyticsServiceProvider"
But I kept on getting: Nothing to publish for tag []. which has lead me to thinking that this could be the problem since the package is not published.
My local environment is Ubuntu and my production Environment is CentOS.. If I try to CD into that directory on my production environment it says cannot find.
Could this therefore be a problem with the case sensitive on how I am adding my providers that is not picking up this package?
are you using cached config files ?
try using
php artisan config:clear
and retry
php artisan vendor:publish
You have to save all for the project before (php artisan vendor:publish).

Laravel 5.0 - Shared Hosting - Artisan not working as it should

I actually wanted to follow up on this question, but I guess It's better to start a new question.
I installed a fresh copy of my own laravel(5.0), and I tried running php artisan route:list, which works.
Now I have downloaded the compressed repository of a project I want to deploy on a shared hosting enviorment, but when I run php artisan route:list nothing happens.(No error message, nothing). Using this method for hosting the application
The actual problem is php artisan migrate, which also outputs nothing!
Is there a good method for troubleshooting this ?
Could you provide me we some points of failure that I can check ?
Worth mentioning:
I'm no Laravel developer and I have limited time reading up on it.
As LittleFinger suggested, it's possible that artisan is not actually yet installed. When deploying from a repo, Laravel's packages of which the entire framework core is composed, are not included. You should run composer install to install the packages. If you don't have composer installed that can be difficult on shared hosting, but it's usually possible to install it.
You will need to run composer install before you run composer update. Running composer update is not required, unless you want to update to the newest versions of your packages which are allowed by the rules in your composer.json file. This should be done with care in a production environment as new versions of packages could break your app.
Once you've installed the packages, you'll need to set your environment variables (database credentials etc.) by copying the .env.example file to .env and editing it. Once you've done this you'll be able to run php artisan key:generate to generate an encryption key.
After this, your app should work (assuming you've pointed a domain to the /public directory).
I am facing the same issue when I try to run
php artisan migrate or php artisan cache:clear
nothing happen just a blank screen no success no error see the screenshot
after debugging I found a message in error_log in root directory which says.
Fatal Error: Allowed Memory Size
after increasing the memory php artisan commands works fine

Unable to update Laravel 4 with Composer (Update: bug?)

Today, I pulled down the laravel/laravel repository from Github. I then ran php composer.phar install (as I normally would on my system, with a command window in the project directory). However, when I ran php composer.phar update, I received this error:
Everything installed just fine, and Laravel works as it should.
Any ideas what could be causing this issue?
Edit 1
artisan exists in the root of the project, but it throws an exception when I attempt to run php artisan optimize:
Side Note 1
If I try the alternative method (quicker) of installing Laravel (php composer.phar create-project laravel/laravel), I get the following:
Edit 2
Upon installation, I also get the same error, where it claims it cannot find artisan. Therefore, the installation does not fully complete. I believe that it is stopping when it wants to compile classes (or something to that effect), and then write bootstrap/compiled.php. That file doesn't exist.
Here's the snap from the install:
Edit 3
It seems that Composer is looking for artisan in the drive root (C:\). Why is it doing this? Even if I specify -d on the update, it throws the error. (I picked this up from a hunch - simply copied artisan to the root of the drive and it found it - albeit, it obviously did not run...)
Solution Found:
Composer makes calls to php artisan <command> (as per the instruction in composer.json > scripts), but it does not see what directory it is running from (perhaps because it is an external command?).
So, I solved my initial problem by using an absolute path to artisan in composer.json.
Everything is working now. I just wish I knew how to get Composer to know that it is running from C:\LocalServer\lab\laravel, and not just C:\.
As i can see, your artisan file is missing. Can you post the exact steps on how you install it ?
Also, please follow http://laravel.com/docs/installation and http://niallobrien.me/2013/03/installing-and-updating-laravel-4/
I had this problem today too. My laravel folder inside the vendor was deleted after composer update. I ran composer install again and problem resolved.

Categories