Jersey LoggingFilter with log4j

Viewed 20218

I have a rest service developed with jersey, I have a ContainerRequestFilters for print the request, as follows:

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

and I have logger in the post methods using log4j. But the LoggingFilter print in the log different log4j. Is there any way that LogginFilter use the log4j's configuration?

I tried this in the log4j.xml file:

<logger name="com.sun.jersey.api.container.filter.LoggingFilter">
    <level value="info" />
    <appender-ref ref="ROOT" />
    <appender-ref ref="CONSOLE" />
</logger>

but it don't work :(

4 Answers
Related