Skip to content

log4js2/http-appender

Repository files navigation

log4js2-http-appender

Provides an HTTP appender for log4js2 that pushes log events to a server endpoint via a POST call.

Build Status codecov dependencies

Installing & Building

If you're building from source, simply run

> npm install
> npm run build

Or, you can install the appender from npm.

> npm install --save @log4js2/http-appender

Configuration

Configure the appender using the configure() method.

import {configure, LogLevel} from '@log4js2/core';
import {HttpAppender} from '@log4js2/http-appender';

configure({
    level: LogLevel.INFO
    layout: '%d [%p] %c %M:%line:%column - %m %ex',
    appenders: ['Console', {
        name: 'Http',
        appender: HttpAppender,
        config: {
            url: '/log-endpoint'
        }
    }],
    loggers: [{
        tag: 'App',
        logLevel : LogLevel.INFO,
        appenders: ['Http']
    }]
});

Note: because posting via HTTP can be intensive, it is a good idea to ensure your appender is only receiving logs from appropriate loggers.

Contributors

Library built and maintained by Robin Schultz

If you would like to contribute (aka buy me a beer), you can send funds via PayPal at the link below.

paypal

About

Provides an HTTP appender for log4js2 that pushes log events to a server endpoint via a POST call

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published