简体   繁体   English

如何在Docker容器中监听运行NestJS的NodeJS的不同通道的日志?

[英]How to listen to different channels of logs of NodeJS running NestJS in a Docker container?

I have a NestJS application running in a Docker container.我有一个在 Docker 容器中运行的 NestJS 应用程序。 I have two loggers;我有两个记录器; the NestJS Logger and Pino. NestJS 记录器和 Pino。

Pino is responsible for listening to requests and responses and printing them to the console, while I use the NestJS logger to print custom messages I output, and for logging errors and the such. Pino 负责监听请求和响应并将它们打印到控制台,而我使用 NestJS 记录器打印我输出的自定义消息,并记录错误等。

I essentially want to open two terminal windows for each one of the loggers and only get logs by one of the two on each.我基本上想为每个记录器打开两个终端窗口,并且每个记录器只获取两个记录之一。 How would I go about accomplishing this?我将如何实现这一目标?

您可以配置在执行时将每个日志保存在两个不同的文件中,例如:req-res-log.txt 和 custom-log.txt,打开终端窗口后使用命令“tail -f -n100 file-path " 在测试期间显示日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker - 如何查看 Docker 容器内运行应用程序的日志? - Docker - How to see the logs of running application inside Docker container? 在 docker 容器中运行 nodejs 串行端口 - Running nodejs serialport in a docker container 如何升级NodeJS Docker容器? - How to upgrade a NodeJS Docker container? 在docker swarm中运行的docker容器中的firebase身份验证错误nodejs应用程序 - firebase authentication error nodejs app in docker container running in docker swarm 如何使用 docker slim 或其他替代方案正确最小化 nestjs / nodejs 应用程序? - How to minimize properly a nestjs / nodejs application with docker slim or other alternatives? NestJs Docker 容器显示错误 - NestJs Docker container shows errors Docker - 如何等待容器运行 - Docker - How to wait for container running Docker 容器与 nodejs app(NestJS) 不能从其他容器或主机访问 - Docker container with nodejs app(NestJS) is not accessible from both other containers or host 如何在docker容器中运行的nodejs应用程序内使用child_process - How to use child_process inside nodejs application running inside docker container 如何通过Google Cloud调试在Docker容器内运行的Nodejs应用程序 - How to debug Nodejs app running inside Docker container via Google Cloud
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM