1. 程式人生 > >log4js error : type "DateFile" could not be found

log4js error : type "DateFile" could not be found

首先我在windows系統上配置log4js(2+)時的配置檔案如下

{  
    "appenders":{  
        "console":{  
            "type":"console"  
        },  
        "common-all":{  
            "type":"DateFile",  
            "filename":"../log/common-all",
            "pattern": "-yyyy-MM-dd.log",  
            "alwaysIncludePattern
": true, "layout":{"type":"pattern", "pattern":"[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"} }
}
, "categories":{ "default":{ "appenders":["common-all"], "level":"all" } } }

這個在windows系統執行正常,但是到了伺服器(centos系統)時就報錯:
這裡寫圖片描述

解決方案:
把”type”:”DateFile”改成”type”:”dateFile”。