nodejs日志文件在哪里? [英] Where is nodejs log file?
本文介绍了nodejs日志文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找不到存储nodejs日志文件的位置. 因为在我的节点服务器中出现分段错误",所以我想查看日志文件以获取更多信息...
I can't find a place where nodejs log file is stored. Because in my node server I have "Segmentation fault", I want to look at log file for additional info...
推荐答案
没有日志文件.每个node.js应用"都是一个单独的实体.默认情况下,它将错误记录到STDERR并输出到STDOUT.您可以在从外壳运行它时将其更改为登录到文件.
There is no log file. Each node.js "app" is a separate entity. By default it will log errors to STDERR and output to STDOUT. You can change that when you run it from your shell to log to a file instead.
node my_app.js > my_app_log.log 2> my_app_err.log
或者(推荐),您可以手动或使用许多日志库之一在应用程序内部添加日志记录:
Alternatively (recommended), you can add logging inside your application either manually or with one of the many log libraries:
- winston
- log4js
- ...
这篇关于nodejs日志文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文