Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit c95e7ad

Browse files
author
Ondrej Kosatka
committed
J-615: LoggingFilter enhancements
Change-Id: I44be4349c4398dffe71d4f1cb8f1ccdb101afa8a
1 parent 714a919 commit c95e7ad

File tree

114 files changed

+3024
-1330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3024
-1330
lines changed

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2013-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -58,7 +58,7 @@
5858
import javax.ws.rs.core.Response;
5959

6060
import org.glassfish.jersey.client.ClientConfig;
61-
import org.glassfish.jersey.filter.LoggingFilter;
61+
import org.glassfish.jersey.logging.LoggingFeature;
6262
import org.glassfish.jersey.server.ResourceConfig;
6363
import org.glassfish.jersey.test.JerseyTest;
6464

@@ -168,12 +168,12 @@ private String veryExpensiveOperation() {
168168
@Override
169169
protected Application configure() {
170170
return new ResourceConfig(AsyncResource.class)
171-
.register(new LoggingFilter(LOGGER, true));
171+
.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
172172
}
173173

174174
@Override
175175
protected void configureClient(ClientConfig config) {
176-
config.register(new LoggingFilter(LOGGER, true));
176+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
177177
config.connectorProvider(new ApacheConnectorProvider());
178178
}
179179

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2012-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -55,7 +55,7 @@
5555
import org.glassfish.jersey.client.ClientConfig;
5656
import org.glassfish.jersey.client.ClientProperties;
5757
import org.glassfish.jersey.client.ClientResponse;
58-
import org.glassfish.jersey.filter.LoggingFilter;
58+
import org.glassfish.jersey.logging.LoggingFeature;
5959
import org.glassfish.jersey.server.ResourceConfig;
6060
import org.glassfish.jersey.test.JerseyTest;
6161

@@ -89,7 +89,7 @@ public Response redirect() {
8989
@Override
9090
protected Application configure() {
9191
ResourceConfig config = new ResourceConfig(RedirectResource.class);
92-
config.register(new LoggingFilter(LOGGER, true));
92+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
9393
return config;
9494
}
9595

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2012-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2012-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -65,7 +65,7 @@
6565
import javax.net.ssl.SSLSession;
6666

6767
import org.glassfish.jersey.client.ClientConfig;
68-
import org.glassfish.jersey.filter.LoggingFilter;
68+
import org.glassfish.jersey.logging.LoggingFeature;
6969
import org.glassfish.jersey.server.ResourceConfig;
7070
import org.glassfish.jersey.test.JerseyTest;
7171

@@ -102,6 +102,7 @@ public class HelloWorldTest extends JerseyTest {
102102

103103
@Path("helloworld")
104104
public static class HelloWorldResource {
105+
105106
public static final String CLICHED_MESSAGE = "Hello World!";
106107

107108
@GET
@@ -129,7 +130,8 @@ public Response getError2() {
129130
@Override
130131
protected Application configure() {
131132
ResourceConfig config = new ResourceConfig(HelloWorldResource.class);
132-
config.register(new LoggingFilter(LOGGER, true));
133+
config.register(new LoggingFeature(LOGGER, Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY,
134+
LoggingFeature.DEFAULT_MAX_ENTITY_SIZE));
133135
return config;
134136
}
135137

@@ -352,7 +354,7 @@ public void testConfigurationUpdate() {
352354

353355
/**
354356
* JERSEY-2157 reproducer.
355-
*
357+
* <p>
356358
* The test ensures that entities of the error responses which cause
357359
* WebApplicationException being thrown by a JAX-RS client are buffered
358360
* and that the underlying input connections are automatically released

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2010-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -62,7 +62,7 @@
6262

6363
import org.glassfish.jersey.client.ClientConfig;
6464
import org.glassfish.jersey.client.ClientProperties;
65-
import org.glassfish.jersey.filter.LoggingFilter;
65+
import org.glassfish.jersey.logging.LoggingFeature;
6666
import org.glassfish.jersey.server.ResourceConfig;
6767
import org.glassfish.jersey.test.JerseyTest;
6868
import org.glassfish.jersey.test.TestProperties;
@@ -126,7 +126,7 @@ protected Application configure() {
126126
enable(TestProperties.DUMP_ENTITY);
127127

128128
ResourceConfig config = new ResourceConfig(HttpMethodResource.class, HeaderWriter.class);
129-
config.register(new LoggingFilter(LOGGER, true));
129+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
130130
return config;
131131
}
132132

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodWithClientFilterTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2010-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -44,7 +44,7 @@
4444
import javax.ws.rs.client.ClientBuilder;
4545

4646
import org.glassfish.jersey.client.ClientConfig;
47-
import org.glassfish.jersey.filter.LoggingFilter;
47+
import org.glassfish.jersey.logging.LoggingFeature;
4848

4949
/**
5050
* @author Paul Sandoz
@@ -55,7 +55,7 @@ public class HttpMethodWithClientFilterTest extends HttpMethodTest {
5555
@Override
5656
protected Client createClient() {
5757
ClientConfig cc = new ClientConfig()
58-
.register(LoggingFilter.class)
58+
.register(LoggingFeature.class)
5959
.connectorProvider(new ApacheConnectorProvider());
6060
return ClientBuilder.newClient(cc);
6161
}

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2013-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -64,7 +64,7 @@
6464
import javax.ws.rs.core.Response;
6565

6666
import org.glassfish.jersey.client.ClientConfig;
67-
import org.glassfish.jersey.filter.LoggingFilter;
67+
import org.glassfish.jersey.logging.LoggingFeature;
6868
import org.glassfish.jersey.server.ClientBinding;
6969
import org.glassfish.jersey.server.ResourceConfig;
7070
import org.glassfish.jersey.server.Uri;
@@ -247,7 +247,7 @@ public Response getTargetB(@Uri("internal/b") @ClientB WebTarget targetB) {
247247
protected Application configure() {
248248
ResourceConfig config = new ResourceConfig(PublicResource.class, InternalResource.class, CustomHeaderFeature.class)
249249
.property(ClientA.class.getName() + ".baseUri", this.getBaseUri().toString() + "internal");
250-
config.register(new LoggingFilter(LOGGER, true));
250+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
251251
return config;
252252
}
253253

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2010-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -51,7 +51,7 @@
5151
import javax.ws.rs.core.Response.Status;
5252

5353
import org.glassfish.jersey.client.ClientConfig;
54-
import org.glassfish.jersey.filter.LoggingFilter;
54+
import org.glassfish.jersey.logging.LoggingFeature;
5555
import org.glassfish.jersey.server.ResourceConfig;
5656
import org.glassfish.jersey.test.JerseyTest;
5757

@@ -79,7 +79,7 @@ public void post(String entity) {
7979
@Override
8080
protected Application configure() {
8181
ResourceConfig config = new ResourceConfig(HttpMethodResource.class);
82-
config.register(new LoggingFilter(LOGGER, true));
82+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
8383
return config;
8484
}
8585

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2014-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -48,7 +48,7 @@
4848
import javax.ws.rs.core.Response;
4949

5050
import org.glassfish.jersey.client.ClientConfig;
51-
import org.glassfish.jersey.filter.LoggingFilter;
51+
import org.glassfish.jersey.logging.LoggingFeature;
5252
import org.glassfish.jersey.message.GZipEncoder;
5353
import org.glassfish.jersey.server.ResourceConfig;
5454
import org.glassfish.jersey.test.JerseyTest;
@@ -64,7 +64,7 @@
6464
public class SpecialHeaderTest extends JerseyTest {
6565
@Override
6666
protected Application configure() {
67-
return new ResourceConfig(MyResource.class, GZipEncoder.class, LoggingFilter.class);
67+
return new ResourceConfig(MyResource.class, GZipEncoder.class, LoggingFeature.class);
6868
}
6969

7070
@Path("resource")

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2013-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -51,7 +51,7 @@
5151

5252
import org.glassfish.jersey.client.ClientConfig;
5353
import org.glassfish.jersey.client.ClientProperties;
54-
import org.glassfish.jersey.filter.LoggingFilter;
54+
import org.glassfish.jersey.logging.LoggingFeature;
5555
import org.glassfish.jersey.server.ResourceConfig;
5656
import org.glassfish.jersey.test.JerseyTest;
5757

@@ -90,7 +90,7 @@ public String getTimeout() {
9090
@Override
9191
protected Application configure() {
9292
final ResourceConfig config = new ResourceConfig(TimeoutResource.class);
93-
config.register(new LoggingFilter(LOGGER, true));
93+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
9494
return config;
9595
}
9696

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2011-2013 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2011-2016 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -61,7 +61,7 @@
6161
import javax.ws.rs.core.Response;
6262

6363
import org.glassfish.jersey.client.ClientConfig;
64-
import org.glassfish.jersey.filter.LoggingFilter;
64+
import org.glassfish.jersey.logging.LoggingFeature;
6565
import org.glassfish.jersey.process.Inflector;
6666
import org.glassfish.jersey.server.ContainerRequest;
6767
import org.glassfish.jersey.server.ResourceConfig;
@@ -113,7 +113,7 @@ public String trace(Request request) {
113113
@Override
114114
protected Application configure() {
115115
ResourceConfig config = new ResourceConfig(TracingResource.class);
116-
config.register(new LoggingFilter(LOGGER, true));
116+
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
117117
final Resource.Builder resourceBuilder = Resource.builder(ROOT_PATH_PROGRAMMATIC);
118118
resourceBuilder.addMethod(TRACE.NAME).handledBy(new Inflector<ContainerRequestContext, Response>() {
119119

@@ -140,7 +140,7 @@ public Response apply(ContainerRequestContext request) {
140140

141141
private WebTarget prepareTarget(String path) {
142142
final WebTarget target = target();
143-
target.register(LoggingFilter.class);
143+
target.register(LoggingFeature.class);
144144
return target.path(path);
145145
}
146146

0 commit comments

Comments
 (0)