Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support for LoggingFIlter

If system property org.neo4j.rest.logging_filter is set to true, verbose request/response logging using Jersey's com.sun.jersey.api.client.filter.LoggingFilter is enabled.
  • Loading branch information...
commit 4fb2b1a04799da4e182936cf7deee5c529dc38a3 1 parent b77fda7
@sarmbruster sarmbruster authored
View
3  README.md
@@ -71,5 +71,4 @@ _timeouts in seconds_
* org.neo4j.rest.driver="neo4j-rest-graphdb/1.8M07"
* org.neo4j.rest.stream=true
* org.neo4j.rest.batch_transactions=true (convert transaction scope into batch-rest-operations)
-
-
+* org.neo4j.rest.logging_filter=false (set to true if verbose request/response logging should be enabled)
View
4 src/main/java/org/neo4j/rest/graphdb/ExecutingRestRequest.java
@@ -27,6 +27,7 @@
import javax.ws.rs.core.MediaType;
+import com.sun.jersey.api.client.filter.LoggingFilter;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.rest.graphdb.util.Config;
import org.neo4j.rest.graphdb.util.JsonHelper;
@@ -69,6 +70,9 @@ protected Client createClient() {
client.setReadTimeout(Config.getReadTimeout());
client.setChunkedEncodingSize(8*1024);
userAgent.install(client);
+ if (Config.useLoggingFilter()) {
+ client.addFilter(new LoggingFilter());
+ }
return client;
}
View
5 src/main/java/org/neo4j/rest/graphdb/util/Config.java
@@ -25,6 +25,7 @@
public final static String CONFIG_PREFIX = "org.neo4j.rest.";
public static final String CONFIG_STREAM = CONFIG_PREFIX + "stream";
public static final String CONFIG_BATCH_TRANSACTION = CONFIG_PREFIX+"batch_transaction";
+ public static final String CONFIG_LOG_REQUESTS = CONFIG_PREFIX+"logging_filter";
public static int getConnectTimeout() {
return getTimeout("connect_timeout", 30);
@@ -42,6 +43,10 @@ public static boolean useBatchTransactions() {
return System.getProperty(CONFIG_BATCH_TRANSACTION,"true").equalsIgnoreCase("true");
}
+ public static boolean useLoggingFilter() {
+ return System.getProperty(CONFIG_LOG_REQUESTS,"false").equalsIgnoreCase("true");
+ }
+
private static int getTimeout(final String param, final int defaultValue) {
return (int) TimeUnit.SECONDS.toMillis(Integer.parseInt(System.getProperty(CONFIG_PREFIX + param, "" + defaultValue)));
}
Please sign in to comment.
Something went wrong with that request. Please try again.