node.js - node中使用log4js问题
PHP中文网
PHP中文网 2017-04-17 15:50:30
0
1
428

本地电脑是windows,部署运行都是没问题的,把今天的日志文件删除了,也会再生成一个。但现在放到了linux服务器上,删掉了之后就没有生成新的。通过node看运行,也显示有log执行,

真是不知道问题在哪里了,还望大家多多指教

代码如下:

var log4js = require('log4js');
log4js.configure({
    appenders: [
        {
            type: 'console',
            category: "console"
        }, //控制台输出
        {
            type: "dateFile",
            filename:'./../logs/data.log',
            maxLogSize: 1024,
            pattern: "_yyyy-MM-dd",
            alwaysIncludePattern: true
        }//日期文件格式
    ],
    replaceConsole: true,
    levels:{
        dateFileLog: 'trace'
    }
});
var dateFileLog = log4js.getLogger('data');
exports.logger = dateFileLog;
exports.use = function(app) {
    //页面请求日志,用auto的话,默认级别是WARN
    app.use(log4js.connectLogger(dateFileLog, {level:log4js.levels.TRACE, format:':method :url'}));
}
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
Ty80

It has been solved. It turns out to be the difference between the file path on Linux and the file path on Windows

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template