1

So, this is my first question here and I'm pretty sure I'd break some guidelines even despite having read the tips on asking good questions.

So I have a NodeJS code that I've just to deploy to production. I want to add logging for obvious reasons, but I am also aware the GCP implements cloud logging and I've used its error-reporting feature a couple of times to debug my code.

So is it still necessary to implement logging for my codebase, seeing as cloud logging offers almost the same feature (if not better)?

I am about to try implementing logging (with either Pino, Winston, or Morgan)

  • I don't think there is a standard reason or logging protocol. You can log via the server - whether you are using nginx, or log custom javascript or log to a third party app via images or other includes. Its down to what your requirements are. I imagine security services wouldn't even use the cloud and have implemented their own encrypted logging solutions. – Steve Tomlin Mar 22 '23 at 09:41

1 Answers1

0

I believe that the approach you should take to logging depends on several factors, such as the time and vision you have for your project.

When it comes to a production system, it's a good idea to log information that can help you debug issues and gain insights into how your application is behaving. Overall, application observability is critical for long-term success, and logs are a key component of that.

My recommendation is to use a package for application-level logging that is suitable for your specific use case, as different packages may be better for different types of systems. Then, you can send the logs, along with some custom metadata like trace-id, service etc to help you identify patterns and create custom queries, to the Google Cloud Platform (GCP) logging service.

Additionally, I suggest using a tool like Sentry, which can be quickly configured to log errors and track application performance. Sentry also provides distributed tracing capabilities, which can help you better understand and address issues as they arise.

By investing some time in these practices, you can establish a strong foundation for maintaining your system over the long term.