Laravel Vapor - Look into logs in different channel in cloudwatch

This commit is contained in:
Dillon Ngo
2024-05-19 23:32:30 +08:00
parent dbeb4f9f04
commit 706e9552a5
2 changed files with 40 additions and 2 deletions
@@ -16,6 +16,7 @@ use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Support\Facades\DB;
use App\Classes\Exceptions\JobResourceNotFoundException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
abstract class AbstractControllerLogic
@@ -65,7 +66,7 @@ abstract class AbstractControllerLogic
} catch (ErrorException|GeneralExceptions|TypeError $exception){
if ($exception instanceof JobResourceNotFoundException) {
Log::channel('vue_polling')->info(sprintf(
LogHelper::channel('vue_polling')->info(sprintf(
"Uncaught exception '%s' with message '%s' in %s:%d",
get_class($exception),
$exception->getMessage(),
+38 -1
View File
@@ -73,7 +73,7 @@ return [
'secret' => env('AWS_CW_SECRET')
]
],
'retention' => 3, //cief todo: to be updated
'retention' => 3, //cief todo: retention to be updated
'level' => 'debug',
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
],
@@ -143,11 +143,48 @@ return [
'level' => 'info',
],
'vue_polling_vapor' => [
'driver' => 'custom',
'via' => \App\Logging\CloudWatchLoggerFactory::class,
'formatter' => Monolog\Formatter\JsonFormatter::class,
'cloudwatch_stream_name' => 'vue_polling_vapor',
'sdk' => [
'region' => env('AWS_MY_REGION'),
'version' => 'latest',
'credentials' => [
'key' => env('AWS_CW_ACCESS'),
'secret' => env('AWS_CW_SECRET')
]
],
'retention' => 3, //cief todo: retention to be updated
'level' => 'debug',
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
],
'perfex_crm' => [
'driver' => 'single',
'path' => storage_path('logs/laravel_perfex_crm.log'),
'level' => 'info',
],
'perfex_crm_vapor' => [
'driver' => 'custom',
'via' => \App\Logging\CloudWatchLoggerFactory::class,
'formatter' => Monolog\Formatter\JsonFormatter::class,
'cloudwatch_stream_name' => 'perfex_crm_vapor',
'sdk' => [
'region' => env('AWS_MY_REGION'),
'version' => 'latest',
'credentials' => [
'key' => env('AWS_CW_ACCESS'),
'secret' => env('AWS_CW_SECRET')
]
],
'retention' => 3, //cief todo: retention to be updated
'level' => 'debug',
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
],
],
];