Log4javascript - Log into a file using AjaxAppender in javascript (not node)

67 Views Asked by At

I am using log4javascript and I created an appender that logs my javascript code in the log4js console. I want to change it, and log everything into a file. I tried the examples I found online, but I couldn't actually find a valid way of writing the logs into a txt file. I am USING log4js file - as reference to log4js ( log4javascript.js downloaded from here), not using the node module or other way of injecting it.

Here's my appender:

var log = log4javascript.getDefaultLogger();
var ajaxAppender = new log4javascript.AjaxAppender(url);
var jsonLayout = new log4javascript.JsonLayout();
ajaxAppender.setLayout(jsonLayout);
log.addAppender(ajaxAppender);
log.info("Hello World");

So, how I can log the info in a file? Also, The url is my domain. Is it right? Or I should write something else there?

Thank you in advance.

0

There are 0 best solutions below