var log4js=require('log4js'); log4js.configure({ appenders: { out: { type: 'stdout' },//设置是否在控制台打印日志 info: { type: 'file', filename: 'c:/LingJiao/logs/lingjiao.log', pattern: "_yyyy-MM-dd", alwaysIncludePattern: false, category: 'dateFileLog' } }, categories: { default: { appenders: [ 'out', 'info' ], level: 'info' }//去掉'out'。控制台不打印日志 } }); var logger = log4js.getLogger('info'); module.exports = logger;