Search

Dark theme | Light theme

January 12, 2009

Add request logging to Cocoon 2.2

Cocoon 2.2 uses the Jetty Maven plugin to run the application. We can add request logging to the configuration of the Jetty plugin so we can see which URLs are invoked to the Jetty server.

First we must look in our pom.xml of our Cocoon 2.2 project. We must find the maven-jetty-plugin plugin block. Here we add to the configuration element the following:

<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
    <filename>target/work/log/yyyy_mm_dd.request.log</filename>
    <retainDays>5</retainDays>
    <append>false</append>
    <extended>true</extended>
    <logTimeZone>GMT+1</logTimeZone>
</requestLog>

This configures request logging for the Jetty server. Now when we run our Cocoon application we can see in the target/work/log directory a file with the requests logged.

The API documentation shows all options we can set for this logger.