Skip to content

A full application that demonstrates how to configure log4js

License

Notifications You must be signed in to change notification settings

zhoubasten/log4js-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log4js-example

A full express application that demonstrates how to configure log4js for the most common use-case.

To run:

npm install
npm start

Log config

Config file is in config/log4js.json. It defines three appenders that are children of the clustered appender. The clustered appender makes sure that only the master process writes to the log files, otherwise having multiple processes try to write at the same time will cause problems. Three log files are defined: log/app.log gets all the log messages and is configured to rotate when the file gets to 10Mb in size, keeping 3 backups of the file; log/errors.log uses the logLevelFilter to only get ERROR messages; log/access.log contains only the http request logs, using the connect-logger, and is configured to rotate every day.

About

A full application that demonstrates how to configure log4js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.7%
  • CSS 3.3%