0

I'm currently trying to setup a csgo gambling site for fun and I'm getting this error when trying to run bot.js

Error: Problem with log4js configuration: ({ appenders:
[ { type: 'console' },
 { type: 'file', filename: 'logs/bot_undefined.log' } ] }) - must have a property "appenders" of type object.
at tests.forEach (/var/www/html/bot/node_modules/log4js/lib/configuration.js:44:15)
at Array.forEach (native)
at Configuration.throwExceptionIf (/var/www/html/bot/node_modules/log4js/lib/configuration.js:42:11)
at new Configuration (/var/www/html/bot/node_modules/log4js/lib/configuration.js:205:10)
at Object.configure (/var/www/html/bot/node_modules/log4js/lib/log4js.js:201:12)
at Object.<anonymous> (/var/www/html/bot/bot.js:18:8)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48
flo31s
  • 1
  • 1
    compare your log4js config to some **[prototypical example such as this one](https://github.com/log4js-node/log4js-example/blob/master/config/log4js.json)**. – YvesLeBorg Sep 28 '17 at 18:18

1 Answers1

0

You are using v2.x of Log4JS with a v0 or v1 appender format. Your appender format should be something like:

log4js.configure({
    appenders: {
        console: {
            type: 'console'
        },
        logstash: {
            host: '123.456.789.123',
            port: 1234,
            type: 'logstashUDP',
            logType: 'myAppType', // Optional, defaults to 'category'
            fields: {             // Optional, will be added to the 'fields' object in logstash
                field1: 'value1',
                field2: 'value2'
            },
            layout: {
                type: 'pattern',
                pattern: '%m'
            }
        }
    },
    categories: {
        default: { appenders: ['console', 'logstash'], level: 'trace' }
    }
});
oooyaya
  • 1,773
  • 1
  • 15
  • 39