Where is nodejs log file?

后端 未结 4 2070
故里飘歌
故里飘歌 2020-11-30 23:13

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...

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 23:43

    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
    • ...

提交回复
热议问题