This package provides log4js-node appender for fluent-logger.
$ npm install log4js-fluent-appender
Fluent daemon should listen on TCP port.
Simple configuration is following:
<source>
@type forward
port 24224
</source>
<match **.*>
@type stdout
</match>
const log4js = require('log4js');
log4js.configure({
appenders: {
fluent: {
type: 'log4js-fluent-appender',
tag_prefix: 'tag_prefix',
options: {
levelTag: true,
host: 'localhost',
port: 24224
}
}
},
categories: {
default: {
appenders: ['fluent'],
level: 'info'
}
}
});
const logger = log4js.getLogger();
logger.info('This is info message!');
setTimeout(() => {
log4js.shutdown(() => {});
}, 1000);
See also:
levelTag
If false
, tag is "mytag". Otherwise tag is "mytag.INFO".
If you want to omit level tag such as .INFO
, you must specify this value to false
.
See fluent-logger.
Apache License, Version 2.0.