I implemented a custom WebSocketAppender for log4j. Log messages were escaped using String.escapeHtml4, newlines were replaced with <br>.
Depending on the log level, messages where printed in bold (WARNING) or in red (ERROR or FATAL).
Events that were considered a problem that needs the user's attention were explicitly stored in a collection, and written to the websocket at the end when the program was done.



For a long running process on a website, provide the user with live feedback

We have a webtool (written in Java EE, using log4j for logging) where users can upload files that are then processed and migrated to a new version, which users can download. Since this process can take quite a while and might fail, users should have live information about the process. Even in case of an overall success there might be errors the users should be informed about.
Subscribe to log4j