zoukankan      html  css  js  c++  java
  • node-log4js3.0.6配置

    const log4js = require('log4js');
    const conf = {
        "appenders": {
          "access": {
            "type": "dateFile",
            "filename": "log/access.log",
            "pattern": "-yyyy-MM-dd",
            "category": "http"
          },
          "app": {
            "type": "file",
            "filename": "log/app.log",
            "maxLogSize": 10485760,
            "numBackups": 3
          },    
          "errorFile": {
            "type": "file",
            "filename": "log/errors.log"
          },
          "errors": {
            "type": "logLevelFilter",
            "level": "ERROR",
            "appender": "errorFile"
          },
          console: { type: 'console' }  //设置窗口打印显示,方面开发环境的调试
        },
        "categories": {
          "default": { "appenders": ['console', "app", "errors"], "level": "all" },
          "http": { "appenders": [ "access"], "level": "DEBUG" }    
        }
      };
    
      log4js.configure(conf);

    上面的设置,cmd窗口打印显示,只打印app,errors的log

    如果只打印app的log,则单独设置app如下;

    "categories": {
          "default": { "appenders": [ "errors"], "level": "all" },
          "http": { "appenders": [ "access"], "level": "DEBUG" } ,
          "app": { "appenders": ['console',"app"], "level": "DEBUG" } 
    }
    
    
  • 相关阅读:
    构建之法阅读笔记02
    学习进度条
    构建之法阅读笔记01
    c++ 与C的区别
    c++ 菜单动态效果
    c++ 方框中绘制菜单代码
    c++ 绘制方框
    c++ 条件编译
    c++ 预处理和多重替换
    c++ 文件共享打开
  • 原文地址:https://www.cnblogs.com/greenteaone/p/10076161.html
Copyright © 2011-2022 走看看