Node.js log4js module prints logs

problem description

how to achieve the log effect of nodejs

the environmental background of the problems and what methods you have tried

write the code according to the introduction of the modules in the NPM package and github, how to start it?

related codes

/ / Please paste the code text below (do not replace the code with pictures)

log4js.json:
{
"appenders":
[

{
  "category":"console",
  "type":"console"
},
{
  "category":"normal",
  "type": "dateFile",
  "filename": "/var/log/graduation-alfred-jade-log/weibo",
  "alwaysIncludePattern": true,
  "pattern": "-yyyy-MM-dd.log",
  "maxLogSize": 1024,
  "backups": 30
}

],
"replaceConsole": true,
"levels":
{

"normal":"ALL",
"console":"ALL"

}
}

log4js.js:
var log4js = require ("log4js");
var log4js_config = require (". / log4js.json");
log4js.configure (log4js_config);

console.log ("log_start start!");

var LogFile = log4js.getLogger ("log_file");

LogFile.trace ("This is a Log4js-Test");
LogFile.debug (" We Write Logs with log4js");
LogFile.info ("You can find logs-files in the log-dir");
LogFile.warn (" log-dir is a configuration-item in the log4js.json");
LogFile.error ("In This Test log-dir is:"/ logs/log_test/"");

console.log ("log_start end!");

what result do you expect? What is the error message actually seen?

write the code according to the introduction of the modules in the NPM package and github, how to start it? This module can see the record of node.js operation

Aug.24,2021

first create the / var/log/graduation-alfred-jade-log/weibo folder manually.
then run your node service, and when there is an output code that executes to your schedule, there will be a log in the folder.


Root directory
node log4js
is it so complicated to hit a log? look at a demo and perfect the logic you need.
   let fs = require('fs');  //fs
     
    let options = {
      flags: 'a',     // append
      encoding: 'utf8',  // utf8
    };
     
    let stdout = fs.createWriteStream('./stdout.log', options);
     
    // logger
    let logger = new console.Console(stdout);
     
    for (let i = 0; i < 100; iPP) {
      logger.log(`log message ${i}`);
    }
    // 100log message + i
    //,fs index.js  cmd =>  node index.js 

log is recorded by yourself through the code. this module can see the record of node.js operation. what is the operation record?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c56a-2c313.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c56a-2c313.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?