-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hi,
I have installed the package for all of the logs in my Laravel 7 project. There is only thing I couldn't figure out. In the Google Cloud Logging (GCL), I can see the logs but there is no trace information. Without the trace it is difficult to point to error in the project.
In logging.php in Laravel I have setup a new channel as follows
'gcl' => [
'driver' => 'custom',
'via' => CodeInternetApplications\MonologStackdriver\Laravel\CreateStackdriverLogger::class,
'logName' => 'Zeus_'.env('APP_ENV'),
],
and changed LOG_CHANNEL to 'gcl' in .env file.
In Logs Explorer in GCL, I see the log as follows
{
"insertId": "1pw3ckdfpobou1",
"jsonPayload": {
"message": "Undefined offset: 4",
"data": {
"exception": {},
"userId": 100014
}
},
"resource": {
"type": "global",
"labels": {
"project_id": "fizbot-v2"
}
},
"timestamp": "2021-05-29T14:30:44.885308Z",
"severity": "ERROR",
"logName": "projects/fizbot-v2/logs/Zeus_local",
"receiveTimestamp": "2021-05-29T14:30:45.324374997Z"
}
I was expecting to see the whole trace under data element in jsonPayload.
After I have added new lineFormat, I can see the last line of the trace in the GCL but not all of it and all of the data is in the message section
'gcl' => [
'driver' => 'custom',
'via' => CodeInternetApplications\MonologStackdriver\Laravel\CreateStackdriverLogger::class,
'logName' => 'Zeus_'.env('APP_ENV'),
'lineFormat' => '[%datetime%] %channel%.%level_name%: %message% %context% %extra%',
],
{
"insertId": "l3chdjfl3i9ht",
"jsonPayload": {
"message": "[2021-05-29T14:36:17.221251+00:00] stackdriver.ERROR: Undefined offset: 4 {\"userId\":100014,\"exception\":\"[object] (ErrorException(code: 0): Undefined offset: 4 at /Users/canatufkansu/Sites/zeus/app/GraphQL/Queries/TestQuery.php:16)\"} []",
"data": {
"userId": 100014,
"exception": {}
}
},
"resource": {
"type": "global",
"labels": {
"project_id": "fizbot-v2"
}
},
"timestamp": "2021-05-29T14:36:17.221298Z",
"severity": "ERROR",
"logName": "projects/fizbot-v2/logs/Zeus_local",
"receiveTimestamp": "2021-05-29T14:36:17.551372993Z"
}
I can live with this but is there better configuration that I can get the whole trace in Google Cloud Logging ?