I see it is possible in the docs but can't seem to find a way of implementing it.
Log API is also available via global PrimeFaces object in case you’d like to use the log component to display your logs.
Using Primefaces 6.2
Primefaces Log Component
Binding Log4J to <p:log id="log" />
PrimeFaces is a lightweight library with one jar, zero-configuration and no required dependencies.
Primefaces is an open source UI component suite for Java Server Faces (JSF) applications. In this tutorial, we'll give an introduction to Primefaces, and demonstrate how to configure it and use some of its main features.
PrimeFaces provides the most advanced Client Side Validation for JavaServer Faces and Java EE. It is used to validate data at client side. It is compatible with Server Side Implementation and provides Advanced Bean Validation Integration.
PrimeFaces is one of the most popular UI libraries in Java Ecosystem and widely used by software companies, world renowned brands, banks, financial institutions, insurance companies, universities and more.
Everything in @Kukeltje's answer is true.
Still, if your end-game is to see your server logs in the front-end of your JSF app, I would do the following:
Initially, I would recommend that you filter the logs when retrieving it from the DB to only show the newest ones in the table, otherwise the table might be too big to load within a reasonable time. As a permanent solution, I would recommend that you implement the LazyDataModel https://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml
It can be very handy to be able to filter and /or sort by log severity, time, and all the fields supported by by your logging framework.
Non related: Splunk has a universal forwarder utility that can submit a copy of your logs to a splunk server so that you can analyze your logs in near realtime. https://www.splunk.com/en_us/download/universal-forwarder.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With