{"id":17621,"library":"express-logger","title":"Express Logger","description":"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.","status":"abandoned","version":"0.0.3","language":"javascript","source_language":"en","source_url":"http://github.com/joehewitt/express-logger","tags":["javascript","express","logger"],"install":[{"cmd":"npm install express-logger","lang":"bash","label":"npm"},{"cmd":"yarn add express-logger","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-logger","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core framework it integrates with; specifically relies on `express.logger` which was a built-in middleware in Express 2.x and 3.x.","package":"express","optional":false}],"imports":[{"note":"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.","symbol":"logger","correct":"const logger = require('express-logger');"}],"quickstart":{"code":"const express = require('express');\nconst logger = require('express-logger');\nconst app = express();\nconst port = 3000;\nconst path = require('path');\nconst fs = require('fs');\n\n// Ensure log directory exists for the example\nconst logDirPath = path.join(__dirname, 'logs');\nif (!fs.existsSync(logDirPath)) {\n    fs.mkdirSync(logDirPath, { recursive: true });\n}\n\n// NOTE: This setup is ONLY for Express versions 2.x or 3.x.\n// It is incompatible with Express 4.x and later because `express.logger` was removed.\napp.use(logger({ path: path.join(logDirPath, 'access.log') }));\n\napp.get('/', (req, res) => {\n  res.send('Hello World! Check your logs in the ' + logDirPath + ' directory.');\n});\n\n// Basic error handling middleware for demonstration (older Express versions)\napp.use((err, req, res, next) => {\n    console.error(err.stack);\n    res.status(500).send('Something broke!');\n});\n\napp.listen(port, () => {\n  console.log(`Express app listening at http://localhost:${port}`);\n  console.log('Access logs will be written to:', path.join(logDirPath, 'access.log'));\n  console.log('\\nWARNING: This package is abandoned and incompatible with modern Express versions (4.x+).');\n  console.log('Do NOT use this in production or with recent Node.js/Express installations.');\n});\n\n// To clean up log directory after testing, manually delete the 'logs' folder created in the script's directory.","lang":"javascript","description":"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."},"warnings":[{"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.","message":"The `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.","severity":"breaking","affected_versions":">=4.0.0 (Express)"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Upgrade to a modern logging and archiving solution compatible with current Node.js LTS releases.","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"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.","cause":"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.","error":"TypeError: app.use() requires middleware functions but got a [object Undefined]"},{"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.","cause":"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.","error":"TypeError: Cannot read properties of undefined (reading 'length') at module.exports"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}