log4js-node-mongodb icon indicating copy to clipboard operation
log4js-node-mongodb copied to clipboard

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

Open MikeRouten opened this issue 8 years ago • 4 comments

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

MikeRouten avatar Sep 05 '17 20:09 MikeRouten

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

4kochi avatar Sep 06 '17 07:09 4kochi

Still doesn't work

GProst avatar Nov 22 '17 10:11 GProst

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

OceanfrontSoftware avatar May 25 '18 18:05 OceanfrontSoftware

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

guilhermebolfe11 avatar Jun 18 '20 14:06 guilhermebolfe11