使用log4js打印日志:
第一步: 导入模块
第二步:配置
{
"appenders": {
"rule-console": {
"type": "console"
},
"mainlog": {
"type": "dateFile",
"filename": "log/Main",
"encoding": "utf-8",
"maxLogSize": 10000000,
"numBackups": 3,
"pattern": "_MMdd.log",
"alwaysIncludePattern": true
}
},
"categories": {
"default": {
"appenders": [
"rule-console",
"mainlog"
],
"level": "debug"
},
"error": {
"appenders": [
"rule-console"
],
"level": "debug"
}
}
}