Eugenio Cuevas
Eugenio Cuevas

Reputation: 11078

Enable jersey logging in weblogic

I cannot get weblogic to ouput the log to the console for jersey. I have this in my web.xml:

    <init-param>
        <param-name>com.sun.jersey.server.impl.container.ContainerRequestFilters</param-name>
        <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.server.impl.container.ContainerResponseFilters</param-name>
        <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
    </init-param>

Which works great with jetty and tomcat. Log4j is also working good because I can get the log output for other modules like hibernate. I have this line in log4j.properties:

log4j.logger.com.sun.jersey=DEBUG

I am using Jersey 1.1.1.5.2 and log4j 1.2.16 on weblogic 10.3.6. Do I have to do something else to make it work?

Upvotes: 1

Views: 1727

Answers (1)

Martin Brugger
Martin Brugger

Reputation: 3158

As documented in com.sun.jersey.api.client.filter.LoggingFilter.java jersey is using the standard JDK logger.

/**
 * Create a logging filter logging the request and response to
 * a default JDK logger, named as the fully qualified class name of this
 * class.
 */

You need to configure JDK logging to correctly log the output. Using jul-to-slf4j + slf4j-log4j12 might do the trick integrating the output into your log4j logfile.

Upvotes: 4

Related Questions