I am writing a web application where the user (among many other things) can build and run their own scripts. The scripts are run on the backend, where they may or may not generate erros - such errors are written to the system log at the moment.
It would be beneficial for the user to see these kind of log events via the web application itself, so I was thinking to pipe & filter them from log4j somehow (before the events hit the disk), so that I have programmatic access to them. Elasticsearch has something that resembles this - when no results are found, it shows the errors that have happened in the given timeframe.
I guess I could just abstract away logging, and make sure all the events are sent to log4j and to the client side as well, but I am hoping there is a better way, without having to touch the logger calls (or having to read from the log files).
Looked at the log4j2 website, but did not find anything useful there - any ideas how to achieve something like this?