Briefly:
Logging Configuration Nodejs-log4js Log output
Reference: HTTP://CNODEJS.ORG/TOPIC/521EE22ABEE8D3CB12FC1F02
Https://github.com/nomiddlename/log4js-node/wiki/Date%20rolling%20file%20appender
Steps:
1. Go to the Express project root path and download the LOG4JS library file
[Plain]View Plaincopy
- NPR Install LOG4JS
2. Configuring the Log4js File
Logger.js
[JavaScript]View Plaincopy
- /**
- * log4js Log output configuration file
- * @type {exports}
- */   
- var log4js = require (
- //Logger Configure
- Log4js.configure ({
- Appenders: [
- { type: ' console '  }, {  
- type: < Span class= "string" style= "margin:0px; padding:0px; border:0px; Color:blue; Background-color:inherit "> ' datefile ' ,&NBSP;&NBSP;
- filename: ,
- pattern: ,
- maxlogsize: 1024,
- Alwaysincludepattern: false ,&NBSP;&NBSP;
- backups: 4,
- category: &NBSP;&NBSP;
- }
- ],
- replaceconsole: true &NBSP;&NBSP;
- });
- Module.exports = Log4js.getlogger (' logger ');
Modular Declaration of the Logger
After you start the project, a log file is generated immediately under the Logs folder.
At the beginning of the document, the Datefile file updates the file in the daily Midnight, and the previous day's file is automatically appended with the end of the date format.
eg
Modify Windows Time
Before the midnight of the day
The logs folder is then generated
Nodejs Log Management Log4js