Created
April 19, 2020 10:35
-
-
Save jsuryahyd/c52ecebcc673a8ab94ae3e3fdadc7800 to your computer and use it in GitHub Desktop.
Create log files date wise using log4js in nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//log | |
const log4js = require("log4js"); | |
const path = require("path"); | |
log4js.configure({ | |
appenders: { | |
errors: { | |
type: "dateFile", | |
filename: path.join(__dirname, "../../logs", "errors.log") | |
} | |
}, | |
categories: { | |
default: { appenders: ["errors"], level: "error" } | |
} | |
}); | |
module.exports.errorLog = log4js.getLogger(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment