3

I'm currently using Laravel 6.16.0.

We are trying to get extensive logging on our application. The Package we have installed is: https://github.com/maxbanton/cwh, and I'm using this to implement it: https://stackoverflow.com/a/51790656/12978881

We're using Stacks for our logging, which includes Slack, Sentry, Laravel logs and CW.

For some reason it just isn't outputting anything to CloudWatch which we want to be the main output.

In the CloudWatchLoggerFactory.php I've even tried throwing any AWS errors like so:

try {
      $handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 10000, $tags);
} catch(\Exception $e) {
      print_r($e);
}

However nothing is even getting that far.

The code is definitely being invoked as it exits with a simple die('test.');

No errors relating to AWS are being output to the log at all. The AWS keys are valid and have the correct permissions.

Has anyone had a similar experience, and how did you sort it?

2 Answers2

2

Try setting the buffer size to 0 like this

try {
      $handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 0, $tags);
} catch(\Exception $e) {
      print_r($e);
}
Aeonmarky
  • 21
  • 2
  • Yep, for anyone else having this issue and comes across this question, this fixed it for me. Thanks – coder_uk Sep 07 '20 at 20:13
0

I am implementing the same these days and it work correctly.

did you add LOG_CHANNEL=stderr to the .env? does the user have permission to write in aws?