79296243

Date: 2024-12-20 05:15:06
Score: 0.5
Natty:
Report link

I know its been a while since this question was asked.

After working on many large scale expressJs, here's my take on the best way to log in expressJs in production.

Use Pino logger and I suggest that because

  1. It is designed with performance as the primary goal.
  2. It uses asynchronous logging and writes logs directly to streams, which minimises the performance impact.
  3. Logs in JSON format by default, which is optimal for modern logging tools and log aggregators

Additionally in production you should also consider using sonic-boom to minimise the number of disk I/O operations, you could set buffer sizes to tell sonic-boom to only write when the logs exceed a certain length.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Rohit Nair