LjLogHelper.js 621 B

12345678910111213141516171819202122232425
  1. var log4js=require('log4js');
  2. log4js.configure({
  3. appenders: {
  4. out: { type: 'stdout' },//设置是否在控制台打印日志
  5. info: {
  6. type: 'file',
  7. filename: __dirname.split("winBoxNode")[0]+"/Logs/lingjiao.log",
  8. pattern: "_yyyy-MM-dd",
  9. alwaysIncludePattern: false,
  10. category: 'dateFileLog',
  11. maxLogSize:104800,
  12. }
  13. },
  14. categories: {
  15. default: { appenders: [ 'out', 'info' ], level: 'info' }//去掉'out'。控制台不打印日志
  16. }
  17. });
  18. var logger = log4js.getLogger('info');
  19. module.exports = logger;