Skip to content

Instantly share code, notes, and snippets.

@jsuryahyd
Created April 19, 2020 10:35
Show Gist options
  • Save jsuryahyd/c52ecebcc673a8ab94ae3e3fdadc7800 to your computer and use it in GitHub Desktop.
Save jsuryahyd/c52ecebcc673a8ab94ae3e3fdadc7800 to your computer and use it in GitHub Desktop.
Create log files date wise using log4js in nodejs
//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