Skip to content

mrelemerson/log4js-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

log4js kafka appender

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published