登录express js到输出文件? [英] Logging in express js to a output file?
问题描述
Regards,
Lalith
查看表示扩展的连接中间件。 express.logger()与connect.logger()相同:
http://expressjs.com/api.html#middleware
http://www.senchalabs.org/connect/logger.html
记录器有一个流选项,可以设置要输出的位置。默认情况下,它发送到stdout。您也可以指定要使用的日志格式。
What is best way to log my express js webserver? The inbuilt express.logger() just displays logs on screen. Can I also log them into a file in /log folder? Also the current logger automatically logs the request and responses. I need to log some application data into the log files. Can this be done using express.logger?
Regards, Lalith
Look at the connect middleware that express extends. The express.logger() is the same as the connect.logger():
http://expressjs.com/api.html#middleware
http://www.senchalabs.org/connect/logger.html
The logger has a stream option that can be set where you want the output to go. By default it sends it to stdout. Also you can specify the log format you want to use.
这篇关于登录express js到输出文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!