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