title: How to log the Console logs into the file using log4js
body: <p>I want to log the console logs whether the expect failing or any exception coming into the log file. How can i do that without using try and catch.
  In LOG4j for java there is rootlogger which automatically logs all the system information logs into the file. Can same be done for log4JS for javascript   </p>
  
  <pre><code>log4js.configure({
    appenders: [
      {
        type: "clustered",
        appenders: [
          {
            type: "dateFile",
            filename: "log/access.log",
            pattern: "-yyyy-MM-dd",
            category: "http"
          },
          {
            type: "file",
            filename: "log/app.log",
            maxLogSize: 10485760,
            numBackups: 3
          },
          {
            type: "logLevelFilter",
            level: "ERROR",
            appender: {
              type: "file",
              filename: "log/errors.log"
            }
          }
        ]
      }
    ]
  })
  </code></pre>