Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Omit Stacktraces in error pages

An example of a web app binding ...

https://github.com/jetty-project/jetty-webapp-logging/blob/master/jetty-webapp-logging/src/main/java/org/eclipse/jetty/webapp/logging/CentralizedWebAppLoggingBinding.java

And the XML to hook it up ...

https://github.com/jetty-project/jetty-webapp-logging/blob/master/jetty-webapp-logging/src/main/config/etc/jetty-webapp-logging.xml

This example is something that was used to force webapps to use a centralized logging at the server level for all logging libs.

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Thu, Jun 30, 2022 at 11:37 AM Lothar Kimmeringer <job@xxxxxxxxxxxxxx> wrote:


Am 30.06.2022 um 06:18 schrieb Greg Wilkins:

> You can use a GlobalWebappConfigBinding in the deployer to apply an XML file to
> every deployed context. This should allow you to get the error page and then set
> the no stack field.

Thanks for mentioning all the options and I've used yours to get this done.
I'm not sure if my actual implementation is suitable as general example,
though ;-) because instead of providing an XML I've overwritten
GlobalWebappConfigBinding's to access the error handlers directly:

     public void processBinding(Node arg0, App arg1) throws Exception {
         ContextHandler ch = arg1.getContextHandler();
         ErrorHandler eh = ch.getErrorHandler();
         eh.setShowStacks(false);
         eh.setShowServlet(false);
     }

> I thought we had some doco/examples, but I'm struggling to find them.

That's a problem, yes. When I search for something I often end up
at an article on wiki.eclipse.org that always starts with
"THIS IS NOT THE DOCUMENTATION YOU ARE LOOKING FOR!!!!!" with the
generic link to the Jetty Documentation Hub.

While my imminent problem is solved, I'd look forward to some example
to see how it's done "correctly" and given the number of similar
questions on Stack Overflow this should make others happy as well.


Thanks and cheers, Lothar
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top