Skip to content

Error: Problem reading log4js config #10

@khwerhahn

Description

@khwerhahn

Hi,

I get an error about reading the log4js config. Here is my setup. What seems to be the problem?

const log4js = require('log4js');
const logstashConnectFormatter = require('log4js-elasticsearch').logstashConnectFormatter;


module.exports = function(app) {
  const ES_CONNECTION = app.get('elasticsearch');
  
   log4js.configure({
    "appenders": [
      {
        "type": "log4js-elasticsearch",
        "buffersize": 1,
        "esclient": ES_CONNECTION,
        "layout": { type: 'logstash' }
      }
    ]
  });

  var logger = log4js.getLogger('express');
  var connectLogger = log4js.connectLogger(logger, { format: logstashConnectFormatter });

  return function(){
    app.use(connectLogger); 
  }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions