A log appender for log4js-node that writes log events to MongoDB. Version 2.2.1 is the latest stable release, compatible with log4js 1.x. It stores logs in a configurable collection with fields for timestamp, data, level, and category. Supports connection options and can log strings or objects. Compared to other MongoDB appenders, it is lightweight and designed specifically for the log4js ecosystem. The package is maintained by Litixsoft but updates are infrequent.
npm install log4js-node-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to integrate the MongoDB appender with log4js, create a logger, and log a string and an object.
Downgrade log4js to v1.x or find an alternative appender that supports log4js v2.
Consider using a modern MongoDB appender or update the connection options for newer drivers.
Append '/yourDatabaseName' to the connection string.
Set type to 'log4js-node-mongodb'.
Run npm install log4js-node-mongodb and verify the package name in require()
Use const mongoAppender = require('log4js-node-mongodb');. Do not use destructuring.Include username:password@host in connectionString or set connectionOptions.auth
Downgrade log4js to v1.x or use configure method instead.