0.0.5 • Published 5 years ago

log4js-kafka v0.0.5

Weekly downloads
449
License
MIT
Repository
github
Last release
5 years ago

log4js-kafka

Kafka appender for log4js.

Installation

npm i log4js-kafka

Setup

TOML

[log4js.appenders.kafka1]
type = "log4js-kafka"
clientId = "demo"
brokers = [ "localhost:9092",]
topic = "topic1"
ssl = false

[log4js.categories.local]
appenders = [ "kafka1",]
level = "debug"

JSON

{
  "log4js": {
    "appenders": {
      "kafka1": {
        "type": "log4js-kafka",
        "clientId": "demo",
        "brokers": [
          "localhost:9092"
        ],
        "topic": "topic1",
        "ssl": false
      }
    },
    "categories": {
      "local": {
        "appenders": [
          "kafka1"
        ],
        "level": "debug"
      }
    }
  }
}

Usage

JS

const log4js = require('log4js');
const logger = log4js.getLogger('local');

logger.debug('Hola mundo');

Options

  • type: log4js-kafka
  • clientId: project ID
  • brokers: kafka instances
  • topic: the topic to send
  • ssl: active
  • DL4K=0: (environment variable) disable the fakfa appender and use the console instead
    • DL4K=0 node server.js

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT