i’ve a JavaScript application.
I’d like to use a logger but instead of logging to a console (like Firebug or Yahoo UI), I’d like to log to a file or several files.
Ideally, It should be possible to back up the files when they reach a certain limit.
thanks.
Writing to a file on the client machine is not generally possible via JavaScript running in a web page. It can be done in IE using ActiveX (when the user has allowed it) and I think also in Firefox when the user has enabled an obscure setting, but is generally not possible. There are various questions about this in Stack Overflow. For example:
Bearing that in mind, it has never seemed worthwhile implementing a local file appender in log4javascript. If you do want to log to a file, I would suggest using the AjaxAppender to send log messages to the server and log those messages to log4j / log4net / log4php / whatever set up with a rolling file appender.