litixsoft / log4js-node-mongodb

A log4js-node log appender to write logs into MongoDB
MIT License
39 stars 23 forks source link

Get 'Cannot read property 'category' of undefined' error #8

Open MikeRouten opened 7 years ago

MikeRouten commented 7 years ago

When trying to configure using the new log4js configuration format

log4js.configure({
    appenders: {
      out: { type: 'stdout' },
      app: { type: 'log4js-node-mongodb', connectionString: config.db_log_url }
    },
    categories: {
      default: { appenders: [ 'out', 'app' ], level: 'debug' }
    }
  });

the following error is raised:

C:\....\node_modules\log4js-node-mongodb\lib\index.js:100
                    category: loggingEvent.logger.category
                                                 ^

TypeError: Cannot read property 'category' of undefined
    at insert (C:\....\node_modules\log4js-node-mongodb\lib\index.js:100:50)
    at Immediate.<anonymous> (C:\....\node_modules\log4js-node-mongodb\lib\index.js:139:17)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

Using log4js v2.3.3 and log4js-node-mongodb v2.2.1

4kochi commented 7 years ago

This will be fixed when #7 is merged this week.

GProst commented 6 years ago

Still doesn't work

OceanfrontSoftware commented 6 years ago

was hoping to see the answer to this, having same issue

guilhermebolfe11 commented 4 years ago

Hello, you could update the package, because the available in npm does not contain this correction, thanks.