Search code examples
loggingjettyosgiequinox

How to provide XML config files to Jetty in OSGi (or how to configure jetty logging in such env)


I have Equinox OSGi Container with Equinox HTTP Jetty service. Equinox HTTP Jetty service uses system properties to configure few basic parameters, such as listen ports and SSL certs but there is no way to configure, for example, Jetty logging. How can I do it?

Actually I need access log of underlying Jetty server.

Whole environment looks like this:

  • OSGi container: Equinox
  • OSGi HTTP Service: Equinox HTTP Jetty
  • JAX-RS: Jersey in bundles
  • my-app -> JAX-RX -> OSGi-HTTP-Service connector: hstaudacher/osgi-jax-rs-connector

Solution

  • As already mentioned Jetty in embedded mode can't do it, but if you use Pax-Web as mediation layer you'll get those kind of easy to use functionalities back. Might as well also take a look at Apache Karaf as easy to use OSGi-Container it also uses Pax Web as HttpService Provider. Another benefit of Pax-Web in this context, you're able to use also a Whiteboard approach to register Servlets of your application with it. See also the way Jetty cann be configured with Pax-Web