Registry / web-framework / express-logger

express-logger

JSON →
library0.0.3jsnpmunverified

express-logger is an Express.js middleware, version 0.0.3, last updated in 2011, designed for automatically archiving log files. It extends the functionality of the `express.logger` built-in middleware, providing daily log rotation and archival. This package is specifically tied to older versions of Express (2.x and 3.x) where `express.logger` was still available. It has been effectively abandoned since its last update over a decade ago and is incompatible with modern Express 4.x and later, which replaced `express.logger` with `morgan`. Due to its age, lack of maintenance, and reliance on deprecated Express APIs, it is not recommended for any current Node.js or Express applications and poses significant security and compatibility risks.

npm install express-logger
INSTALL
IMPORT
SIG · EXPRESS-LOGGER
E
express-logger
web-frameworkjavascriptv0.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

logger
const logger = require('express-logger');
This package exclusively uses CommonJS modules due to its age and pre-dates widespread ESM adoption in the Node.js ecosystem. It expects to be used within a CommonJS environment.

Demonstrates the basic integration of express-logger with an Express application, showing how to set up log archiving to a specified file path. Note that this example is designed for older Express versions (2.x/3.x) and will not work with Express 4.x or newer due to API changes.

const express = require('express'); const logger = require('express-logger'); const app = express(); const port = 3000; const path = require('path'); const fs = require('fs'); // Ensure log directory exists for the example const logDirPath = path.join(__dirname, 'logs'); if (!fs.existsSync(logDirPath)) { fs.mkdirSync(logDirPath, { recursive: true }); } // NOTE: This setup is ONLY for Express versions 2.x or 3.x. // It is incompatible with Express 4.x and later because `express.logger` was removed. app.use(logger({ path: path.join(logDirPath, 'access.log') })); app.get('/', (req, res) => { res.send('Hello World! Check your logs in the ' + logDirPath + ' directory.'); }); // Basic error handling middleware for demonstration (older Express versions) app.use((err, req, res, next) => { console.error(err.stack); res.status(500).send('Something broke!'); }); app.listen(port, () => { console.log(`Express app listening at http://localhost:${port}`); console.log('Access logs will be written to:', path.join(logDirPath, 'access.log')); console.log('\nWARNING: This package is abandoned and incompatible with modern Express versions (4.x+).'); console.log('Do NOT use this in production or with recent Node.js/Express installations.'); }); // To clean up log directory after testing, manually delete the 'logs' folder created in the script's directory.
Debug
Known issues
breakingThe `express-logger` package is fundamentally incompatible with Express.js versions 4.x and later. It relies on the built-in `express.logger` middleware, which was removed from Express starting with version 4.0 and replaced by `morgan` as a separate package. Attempting to use `express-logger` with modern Express will result in runtime errors.
fix
Migrate to `morgan` for request logging and a dedicated log rotation library (e.g., `winston`, `pino` with logrotate capabilities, or `rotating-file-stream`) for archiving.
affects: >=4.0.0 (Express)
gotchaThis package is effectively abandoned. It was last published in 2011 (version 0.0.3) and has received no updates or maintenance since. Using abandoned software in production carries significant security risks, as unpatched vulnerabilities could be exploited. It is also unlikely to be compatible with recent Node.js versions or dependencies.
fix
Avoid using this package. Consider modern, actively maintained logging solutions like `winston`, `pino`, or `bunyan` for robust logging and `morgan` for HTTP request logging, combined with file rotation utilities.
affects: >=0.0.1
gotchaThe package specifies Node.js engine requirement `>=0.4.0`, an extremely outdated version of Node.js. Running this package on modern Node.js versions (e.g., Node.js 14+) may lead to unexpected behavior or errors due to breaking changes in the Node.js runtime and its core modules over the last decade.
fix
Upgrade to a modern logging and archiving solution compatible with current Node.js LTS releases.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: app.use() requires middleware functions but got a [object Undefined]
This error typically occurs when trying to use `express-logger` with Express 4.x or newer. The underlying `express.logger` middleware that `express-logger` extends was removed from Express and is therefore `undefined` when invoked.
fix
Do not use `express-logger` with Express 4.x+. Replace it with `morgan` for request logging and a separate log rotation solution for archiving.
TypeError: Cannot read properties of undefined (reading 'length') at module.exports
This error can appear in specific scenarios when `express-logger` is instantiated, particularly if the `express` object it expects is not correctly configured or if internal assumptions of the 2011 codebase conflict with the environment.
fix
This specific error often points to deeper compatibility issues with modern environments. The recommended fix is to replace `express-logger` entirely with current logging libraries.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
expressrequiredCore framework it integrates with; specifically relies on `express.logger` which was a built-in middleware in Express 2.x and 3.x.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Resources
express-logger — npm install express-logger · libregistry