Closed macrozone closed 9 months ago
Hi @macrozone, as mentioned in https://github.com/googleapis/nodejs-logging-winston/issues/623, google cloud logging libraries are intended to write logs into Google Cloud Logging service and we do not support "local" mode of work.
If you still want to have this working without crashing, you can do the following:
Set up "project_id" environment variable before running your application: export GCLOUD_PROJECT=your_project_id
. I tried your code sample with this variable specified in my environment, it worked for me without crashing. You can also define the desired project id via LoggingOptions.projectId
parameter.
As mentioned here, express middleware is still an experimental feature. This library is not intended for supporting local mode, we do require "project_id" to composite the logging path where log entries are written to. If you really want to use the logger without specifying the project_id locally, instead of using express middleware, you can use this logger without middleware and add a default call back for error handling: https://github.com/googleapis/nodejs-logging-winston#error-handling-with-a-default-callback
Closing the issue as it is intended that logging libraries don't support "local" mode. Please set up "project_id" through environment variable orLoggingOptions.projectId
. You can also use default callback to add error handling for your environment.
this is similar to this issue https://github.com/googleapis/nodejs-logging-winston/issues/623
its completly natural that you use this library first locally, where there is no connection to any google cloud project and you don't want to push the logs to google cloud
even if you pass a local transport to the express middleware, it crashes with
the logger and middleware is created here:
calling the app with passing
GOOGLE_PROJECT
variable also does not workEnvironment details
@google-cloud/logging-winston
version: 6.0.0Steps to reproduce