LjLogHelper.js 567 B

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