Author Topic: Logging to Text File  (Read 1568 times)

Is it possible for a plugin to log to it's own text log file?

I'm not sure what you really want to do, but you can maybe define your own log helpers to write inside a file.
I know that you can use a XMLHttpRequest to read or write a text file ('GET' method to read and 'PUT' method to write)
Something like:
Code: [Select]
    var read_request = new XMLHttpRequest();"GET", file_path, false);
    // read_request.responseText should contain your file text
Code: [Select]
    var write_request = new XMLHttpRequest();"PUT", file_path, false);

Is there anything that would cause this method to work in one plugin, and not another?

I'm parsing json files just fine with this method in one plugin.. and while developing another plugin, I can't get the exact same code to work. Even with the exact same json file. The XmlHttpResponse.responseText always returns a string with a length of 0 in the 2nd plugin, which of course throws a Json Parse error.