Posts

Showing posts from September, 2013

Karaf and Pax Web: disabling reverse lookup

Karaf can be a full WebContainer just by installing the war feature: features:install war The war feature will install Pax Web and Jetty web server. You can configure Pax Web using a configuration file etc/org.ops4j.pax.web.cfg. In this configuration, you can define a Jetty configuration file (like jetty.xml) using the following property: org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml Now, using the etc/jetty.xml, you have a complete access to the Jetty configuration, especially, you can define the Connector configuration. In the “default” connector (bound to port 8181 by default), you can set “advanced” configuration. An interesting configuration is the reverse lookup. Depending of your network, the DNS resolution may not work. By default, Jetty will try to do reverse DNS resolution, and if you can’t use a DNS server on the machine, you may encounter “bad response time”, because you will have to wait the timeout for each DNS lookup. ...

Pax Logging: loggers log level

As you probably know, Apache Karaf uses Pax Logging as logging system. Pax Logging is an OPS4j project (Open Participation Software 4 Java) which provide a fully OSGi compliant framework for logging. Pax Logging leverages a bunch of logging frameworks like slf4j, logback, log4j, avalong, etc. It gathers all the configuration and the actual logging mechanisms in a central way. It means that, in your applications/bundles, you can use slf4j or log4j, it doesn’t matter, behind the hood you will use Pax Logging. Karaf provides a bunch of shell commands and MBean for logging: log:display to see the log log:display-exception to see only the exceptions log:tail to display and “follow on the fly” the log log:set to change the log level of a particular logger (or the rootLogger) log:get to get the current log level of a particular logger (or the rootLogger) The default configuration is a log4j configuration described in etc/org.ops4j.pax.logging.cfg. It’s where you especia...