Express Morgan not writing logs to file or STDOUT
来源:互联网 发布:windows讲述人快捷键 编辑:程序博客网 时间:2024/05/16 03:34
http://stackoverflow.com/questions/35904450/express-morgan-not-writing-logs-to-file-or-stdout
I figured it out- the logging code needed to be located in the app.js file, not in the file that holds the api calls. I knew the logging code needed to be the first piece of middleware, but I didn't realize it needed to be right after the new instance of the server is instantiated.
var express = require('express'), app = express(), config = require('./src/config/server.config'), morgan = require('morgan'), fs = require('fs'),//api and server http = require('http'), server = new http.Server(app); //set up the loggervar accessLogStream = fs.createWriteStream(__dirname + '/access.log', {flags: 'a'})app.use(morgan('combined', {"stream": accessLogStream}));//load the api calls for the servervar apiRoutes = require('./src/api/calls.js');apiRoutes(app);
0 0
- Express Morgan not writing logs to file or STDOUT
- Output message to a file or stdout
- According to TLD or attribute directive in tag file, attribute value does not accept any express
- 解决:According to TLD or attribute directive in tag file, attribute value does not accept any express。
- 解决:According to TLD or attribute directive in tag file, attribute value does not accept any express。
- 解决:According to TLD or attribute directive in tag file, attribute value does not accept any express。
- Writing to a Temporary File
- writing dumpstate to file android
- Writing to a Binary File
- express中间件--Morgan
- python 3.5: TypeError: a bytes-like object is required, not 'str' when writing to a file
- android,NDK, write logs to a file
- FILE *stdout 和 STDOUT
- Reading and Writing Logs
- Writing Change Logs
- Reading and Writing Logs
- Python IOError: File not open for writing
- vi编辑文件保存后,提示“Can't open file for writing Press ENTER or type command to continue”
- Codeforces Round #343 (Div. 2) D. Babaei and Birthday Cake
- 伽罗华域(Galois Field,GF,有限域)
- Impala5.7.1 build in linux environment(Centos6.6)
- 地理编码反地理编码, 根据地名获取经纬度等信息
- android SwipeRefreshLayout 波动下拉刷新
- Express Morgan not writing logs to file or STDOUT
- MFC ComboBox的使用
- SDK、JDK、JRE、JVM、JDT、CDT等之间的区别与联系
- HDU 4127 Flood-it!
- 木马免杀技术大盘点和PE基础知识
- 阿里云推荐码dy37zm
- 关于android
- Cognos API Connection
- vmware虚拟机中设置固定IP