This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new 91e77d7fbdeb [backport camel-4.22.x] CAMEL-26347: camel-wordpress - 
stop adding CXF logging interceptors to the WordPress client (#28577)
91e77d7fbdeb is described below

commit 91e77d7fbdeb547ce6120582b9aef2a2fe4a2b5b
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Oct 27 18:05:35 2026 +0100

    [backport camel-4.22.x] CAMEL-26347: camel-wordpress - stop adding CXF 
logging interceptors to the WordPress client (#28577)
    
    CAMEL-26347: camel-wordpress - stop adding CXF logging interceptors to the 
WordPress client
    
    The service adapters added the CXF LoggingInInterceptor and
    LoggingOutInterceptor to every client, so each request and response was
    logged at INFO. Leave the client with the interceptors CXF sets up, drop
    the now unused cxf-rt-features-logging dependency and remove the leftover
    log4j.properties from the main resources.
    
    
    (cherry picked from commit feb43422889f21ff4959c3766b87ee1305f52687)
    
    Co-authored-by: Claude <[email protected]>
---
 components/camel-wordpress/pom.xml                 |  5 --
 .../impl/AbstractWordpressServiceAdapter.java      |  8 ---
 .../src/main/resources/log4j.properties            | 32 ----------
 ...pressServiceAdapterClientConfigurationTest.java | 70 ++++++++++++++++++++++
 .../ROOT/pages/camel-4x-upgrade-guide-4_22.adoc    |  6 ++
 5 files changed, 76 insertions(+), 45 deletions(-)

diff --git a/components/camel-wordpress/pom.xml 
b/components/camel-wordpress/pom.xml
index 0a332d1ef265..9e9fdcab20df 100644
--- a/components/camel-wordpress/pom.xml
+++ b/components/camel-wordpress/pom.xml
@@ -72,11 +72,6 @@
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
             <version>${cxf-version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-features-logging</artifactId>
-            <version>${cxf-version}</version>
-        </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
diff --git 
a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/service/impl/AbstractWordpressServiceAdapter.java
 
b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/service/impl/AbstractWordpressServiceAdapter.java
index 4804ad60e105..17bee2bb4136 100644
--- 
a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/service/impl/AbstractWordpressServiceAdapter.java
+++ 
b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/service/impl/AbstractWordpressServiceAdapter.java
@@ -24,8 +24,6 @@ import 
com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
 import org.apache.camel.component.wordpress.api.auth.WordpressAuthentication;
 import org.apache.camel.component.wordpress.api.service.WordpressService;
 import org.apache.camel.util.ObjectHelper;
-import org.apache.cxf.ext.logging.LoggingInInterceptor;
-import org.apache.cxf.ext.logging.LoggingOutInterceptor;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.slf4j.Logger;
@@ -52,12 +50,6 @@ abstract class AbstractWordpressServiceAdapter<A> implements 
WordpressService {
         // TODO: leave this kind of configuration to API clients
         
WebClient.getConfig(spi).getHttpConduit().getClient().setAutoRedirect(true);
 
-        /*
-         * TODO: aggregate a configuration object to customize the JAXRS 
behavior, eg.: adding handlers or interceptors
-         */
-        WebClient.getConfig(spi).getInInterceptors().add(new 
LoggingInInterceptor());
-        WebClient.getConfig(spi).getOutInterceptors().add(new 
LoggingOutInterceptor());
-
         LOGGER.info("******* {} API initialized *********", 
spi.getClass().getSimpleName());
     }
 
diff --git a/components/camel-wordpress/src/main/resources/log4j.properties 
b/components/camel-wordpress/src/main/resources/log4j.properties
deleted file mode 100644
index 759df99d8001..000000000000
--- a/components/camel-wordpress/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used
-#
-log4j.rootLogger=INFO, out
-
-# uncomment the following line to turn on Camel debugging
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
-
-log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file
diff --git 
a/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/service/impl/WordpressServiceAdapterClientConfigurationTest.java
 
b/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/service/impl/WordpressServiceAdapterClientConfigurationTest.java
new file mode 100644
index 000000000000..209dec136334
--- /dev/null
+++ 
b/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/service/impl/WordpressServiceAdapterClientConfigurationTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.wordpress.api.service.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
+import org.apache.camel.component.wordpress.api.WordpressConstants;
+import 
org.apache.camel.component.wordpress.api.auth.WordpressBasicAuthentication;
+import org.apache.camel.component.wordpress.api.model.User;
+import org.apache.camel.component.wordpress.api.service.spi.UsersSPI;
+import 
org.apache.camel.component.wordpress.api.test.WordpressMockServerTestSupport;
+import 
org.apache.camel.component.wordpress.api.test.WordpressServerHttpRequestHandler;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxrs.client.ClientConfiguration;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.message.Message;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * The client created by the service adapters keeps the interceptors CXF sets 
up for a JAX-RS client: the adapters do
+ * not add interceptors of their own.
+ */
+public class WordpressServiceAdapterClientConfigurationTest extends 
WordpressMockServerTestSupport {
+
+    @Test
+    public void testAdapterKeepsDefaultInterceptors() {
+        final WordpressServiceUsersAdapter adapter
+                = new WordpressServiceUsersAdapter(getServerBaseUrl(), 
WordpressConstants.API_VERSION);
+        adapter.setWordpressAuthentication(new WordpressBasicAuthentication(
+                WordpressServerHttpRequestHandler.USERNAME, 
WordpressServerHttpRequestHandler.PASSWORD));
+        final UsersSPI plain = JAXRSClientFactory.create(getServerBaseUrl(), 
UsersSPI.class,
+                Collections.singletonList(new JacksonJsonProvider()));
+
+        final ClientConfiguration actual = 
WebClient.getConfig(adapter.getSpi());
+        final ClientConfiguration expected = WebClient.getConfig(plain);
+        assertThat(types(actual.getOutInterceptors()), 
is(types(expected.getOutInterceptors())));
+        assertThat(types(actual.getInInterceptors()), 
is(types(expected.getInInterceptors())));
+        assertThat(types(actual.getOutFaultInterceptors()), 
is(types(expected.getOutFaultInterceptors())));
+        assertThat(types(actual.getInFaultInterceptors()), 
is(types(expected.getInFaultInterceptors())));
+
+        final User user = adapter.retrieve(1);
+        assertThat(user, not(nullValue()));
+    }
+
+    private static List<String> types(List<Interceptor<? extends Message>> 
interceptors) {
+        return interceptors.stream().map(i -> 
i.getClass().getName()).sorted().toList();
+    }
+}
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
index 49986b416b50..07089ed61ee4 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
@@ -50,6 +50,12 @@ first consumer's settings. Such a consumer now fails to 
start with an `IllegalAr
 port. Give every consumer on a host and port the same `SSLContextParameters` 
instance (for example the same bean
 reference, or the global SSL context parameters), or move consumers that need 
other settings to another port.
 
+=== camel-wordpress - requests and responses are no longer logged
+
+The WordPress client no longer logs every HTTP request and response it 
exchanges with the WordPress server at `INFO`
+level (the `org.apache.cxf.services` loggers). The component no longer depends 
on `cxf-rt-features-logging`, and the
+`camel-wordpress` JAR no longer contains a `log4j.properties` file.
+
 == Upgrading from 4.22.1 to 4.22.2
 
 === camel-management - Route group exchange counters count once per entry into 
the group again

Reply via email to