log4js-node / log4js-example

A full application that demonstrates how to configure log4js
MIT License
141 stars 115 forks source link

configuration file log4js.json does not contain a valid configuration #7

Open jpstotz opened 4 years ago

jpstotz commented 4 years ago

When using the sample configuration file config/log4js.json log4js is unable to load this configuration:

 "appenderList.forEach is not a function" (TypeError: appenderList.forEach is not a function
    at configureAppenders (node_modules\log4js\lib\log4js.js:248:18)
    at configureOnceOff (node_modules\log4js\lib\log4js.js:308:7)
    at Object.configure (node_modules\log4js\lib\log4js.js:371:3)

A valid configuration file looks more like this:

{
    "appenders": [
      {
        "type": "dateFile",
        "filename": "log/access.log",
        "pattern": "-yyyy-MM-dd",
        "category": "http"
      },
      {
        "type": "file",
        "filename": "log/app.log",
        "maxLogSize": 10485760,
        "numBackups": 3
      }
    ]
  }
golimarrrr commented 4 years ago

Also in bin/www there is this line that refers to a logger that doesn't exist in the config file:

var log = log4js.getLogger("startup");