pagevamp / laravel-cloudwatch-logs

Cloud Watch Driver for Laravel as needed at pagevamp
93 stars 48 forks source link

I think there still might be something going on here. #45

Closed gregclarity closed 1 year ago

gregclarity commented 1 year ago
          I think there still might be something going on here.

We pushed updates to all of our deployments yesterday and all of a sudden cloudwatch logging quit working. No errors, nothing amiss on the frontend, just logs stopped showing up in CW.

I went looking and found this ticket, then did a composer update... I pulled the latest version of this dependency 1.1.1, and verified the fixes outlined here are in my vendor dir...

I also tried the workaround written above and still no logs. Any help would be greatly appreciated on this as we've got some production clients running on this.

Originally posted by @gregclarity in https://github.com/pagevamp/laravel-cloudwatch-logs/issues/43#issuecomment-1700152838

prezire commented 1 year ago

Just found this package and started to using it today and nothing seems to be working. No logs in CW. However, if I unintentionally make a non-existing command like a wrong spelling of some sort, the error gets logged to CW like php artisan optimize:something.

hungnv-sr commented 1 year ago

@gregclarity I used composer require pagevamp/laravel-cloudwatch-logs:1.1.1 to update my dependencies and it worked fine. How did you pull latest version?

@prezire

make a non-existing command like a wrong spelling of some sort, the error gets logged to CW like php artisan optimize:something.

I think this is intended.

nothing seems to be working

this is not. What log level did you used in your code and your configuration?

gregclarity commented 1 year ago

Initially I just did a composer update and it pulled down the latest version (1.1.1).

Just now I did a composer require pagevamp/laravel-cloudwatch-logs:1.1.1 as suggested, and then another composer update after. Nothing was downloaded/updated.

As far as log-levels go, we are logging everything, min_log_level=debug

It should be noted that when I switch to the daily LOG_CHANNEL I get the normal logs that I'd expect.

warci commented 1 year ago

same here, no log group gets created although both the task role and task execution role have the correct permissions.

gregclarity commented 1 year ago

FYI: I'm on laravel ^9.0

dleo commented 1 year ago

Same vibes here.

I got this error after try v1.1.1

`[2023-09-04 20:43:58] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (Error(code: 0): Class \"PhpNexus\Cwh\Handler\CloudWatch\" not found at /opt/project/vendor/pagevamp/laravel-cloudwatch-logs/src/Logger.php:34) [stacktrace]

0 /opt/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(237): Pagevamp\Logger->__invoke()

1 /opt/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(210): Illuminate\Log\LogManager->createCustomDriver()

2 /opt/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(125): Illuminate\Log\LogManager->resolve()

3 /opt/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(112): Illuminate\Log\LogManager->get()

4 /opt/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(631): Illuminate\Log\LogManager->driver()

5 /opt/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Log\LogManager->info()

6 /opt/project/tests/Feature/LogTest.php(19): Illuminate\Support\Facades\Facade::__callStatic()

7 /opt/project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1608): Feature\LogTest->canCallLogger()

8 /opt/project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1214): PHPUnit\Framework\TestCase->runTest()

9 /opt/project/vendor/phpunit/phpunit/src/Framework/TestResult.php(728): PHPUnit\Framework\TestCase->runBare()

10 /opt/project/vendor/phpunit/phpunit/src/Framework/TestCase.php(964): PHPUnit\Framework\TestResult->run()

11 /opt/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(684): PHPUnit\Framework\TestCase->run()

12 /opt/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(684): PHPUnit\Framework\TestSuite->run()

13 /opt/project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(651): PHPUnit\Framework\TestSuite->run()

14 /opt/project/vendor/phpunit/phpunit/src/TextUI/Command.php(144): PHPUnit\TextUI\TestRunner->run()

15 /opt/project/vendor/phpunit/phpunit/src/TextUI/Command.php(97): PHPUnit\TextUI\Command->run()

16 /opt/project/vendor/phpunit/phpunit/phpunit(107): PHPUnit\TextUI\Command::main()

17 {main}

"} `

vanessasoutoc commented 1 year ago

Hi guys, Change line "pagevamp/laravel-cloudwatch-logs":"^1.0" on composer.json to "pagevamp/laravel-cloudwatch-logs": "1.0.3". Remove composer.lock and folder vendor. Run command composer install

Success!

hungnv-sr commented 1 year ago

Version 1.1.1 doesn't work with Laravel version lower than 10, my bad. Lock your version to 1.0.3 for Laravel 9 and below according to @vanessasoutoc .

Thanks @vanessasoutoc .

gregclarity commented 1 year ago

Awesome. Thanks for the info. I rolled back to 1.0.3 and we're back to logging correctly.

Thankfully I'll be upgrading us to laravel 10.x soon so I won't have to be using old code for long.