mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
1.1 KiB
1.1 KiB
Redis Appender
Stores log events in a Redis database. You will need to include the redis package in your application's dependencies to use this appender.
Configuration
type-redishost-string(optional, defaults to127.0.0.1) - the location of the redis serverport-integer(optional, defaults to6379) - the port the redis server is listening onpass-string(optional) - password to use when authenticating connection to redischannel-string- the redis channel that log events will be published tolayout-object(optional, defaults tomessagePassThroughLayout) - the layout to use for log events (see layouts).
The appender will use the Redis PUBLISH command to send the log event messages to the channel.
Example
log4js.configure({
appenders: {
redis: { type: 'redis', channel: 'logs' }
},
categories: { default: { appenders: ['redis'], level: 'info' } }
});
This configuration will publish log messages to the logs channel on 127.0.0.1:6379.