Skip to content

log4js2/file-appender

Repository files navigation

log4js2-file-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/file-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: 'RollingFile',
        appender: RollingFileAppender,
        config: {
            fileName: 'logs/app.log',
            filePattern: 'logs/app.%i.log',
            maxBackup: 5,
            maxSize: 10
        }
    }],
    loggers: [{
        tag: 'App',
        logLevel : LogLevel.INFO,
        appenders: ['Console', 'RollingFile']
    }]
});

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 file appenders for log4js2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published