I am using Log4js Library to print the log message in a file. In that I am getting 2 issues. Such as:
12:00:40 PM ERROR Log4js - TypeError: netscape.security.PrivilegeManager is undefined
in Non-IE Browser. Please tell me how to fix this exception. While Using IE , It's working fine.- How to get the
CATALINA_HOME
in the JavaScript part. I am using Tomcat. To get thisCATALINA_HOME
in Log4j, we need to write as followlog4j.appender.FILE.File=${catalina.base}/logs/MyLogs.log
. If I'll write the catalina.base, not working in the JavaScript.
Here is my code please have a look on my code and detect the error causing line to have the solution:
<script type="text/javascript">
function myFunction(name) {
var date = new Date();
var log = Log4js.getLogger("fileAppender");
log.setLevel(Log4js.Level.ALL);
var toAppend=date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
var fileAppender = new Log4js.FileAppender("${catalina.base}\\logs\\JSLogging."+toAppend+".log");
log.addAppender(fileAppender);
log.debug("My Debugging");
log.info("My Information");
}
</script>