diff --git a/app.config.json b/app.config.json index a9004e8..8a5bd69 100644 --- a/app.config.json +++ b/app.config.json @@ -25,7 +25,7 @@ "file" : true }, "detail" : { - "time" : 2, + "time" : 15, "size" : null, "path" : "./logs/detail", "console" : false, diff --git a/app.js b/app.js index 101c0ae..1327c0f 100644 --- a/app.js +++ b/app.js @@ -6,8 +6,6 @@ const utils = require('utils/utils'); var log = require('./utils/log'); var constants = require('./utils/constants'); -var logg = require('./utils/commonlog').init(conf.get("configlog"),app); - utils.testUnit(1,2,3,4,5); // console.log(conf.get('redis.host')); @@ -121,7 +119,7 @@ app.use(bodyParser.json()); // app.use(passport.session()); - +var logg = require('./utils/commonlog').init(conf.get("configlog"),app); app.use(function (req, res, next) { // add generated request-id to session //req.session.reqId = req.id; diff --git a/package.json b/package.json index 6d29e91..574d5b5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "mocha unitTest", "start": "npm run test && node app.js", "gentest": "mocha unitTest && NODE_ENV=gentest node app.js", - "pullpm2": "git stash && git pull && npm install && pm2 stop hospital && pm2 start node app.js --name=hospital ", + "pullpm2": "git stash && git pull && npm install && pm2 restart app.js --name=hospital ", "pull": "git stash && git pull && npm install && pm2 stop hospital && npm run start " }, "author": "Source Code", diff --git a/utils/commonlog.js b/utils/commonlog.js index 5b35f14..c3122f6 100644 --- a/utils/commonlog.js +++ b/utils/commonlog.js @@ -628,7 +628,7 @@ log.init = function (_conf, express) { if(typeof log.sessionID === 'function'){ sid = log.sessionID(req, res); } - + let txtLogReq = 'INCOMING|__Method=' +req.method + ' __URL=' + req.url + ' __Headers=' + JSON.stringify(req.headers ) @@ -644,7 +644,7 @@ log.init = function (_conf, express) { onHeaders(res, ()=>{ let txtLogRes = 'OUTGOING|__Statuscode=' + res.statusCode + ' __Headers=' + JSON.stringify(res._headers ) - + ' __Body=' + JSON.stringify(res.body ) + + ' __Body=' + req.res.resBody + ' __Restime=' + ( Date.now() - req._reqTimeForLog ); if(sid){ -- libgit2 0.21.2