From 39f4271be00c8d7cee12e7a3623427a0444ad894 Mon Sep 17 00:00:00 2001 From: fyrz Date: Thu, 19 Mar 2015 21:58:03 +0100 Subject: [PATCH] [RocksJava] Enhanced Logger comment Added information about performance penalties using a custom logger implementation. --- java/src/main/java/org/rocksdb/Logger.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/java/src/main/java/org/rocksdb/Logger.java b/java/src/main/java/org/rocksdb/Logger.java index 5796d5b1c..05c53b56e 100644 --- a/java/src/main/java/org/rocksdb/Logger.java +++ b/java/src/main/java/org/rocksdb/Logger.java @@ -13,6 +13,27 @@ package org.rocksdb; *

Using this class RocksDB can log with common * Java logging APIs like Log4j or Slf4j without keeping * database logs in the filesystem.

+ * + * Performance + *

There are certain performance penalties using a Java + * {@code Logger} implementation within production code. + *

+ * + *

+ * A log level can be set using {@link org.rocksdb.Options} or + * {@link Logger#setInfoLogLevel(InfoLogLevel)}. The set log level + * influences the underlying native code. Each log message is + * checked against the set log level and if the log level is more + * verbose as the set log level, native allocations will be made + * and data structures are allocated. + *

+ * + *

Every log message which will be emitted by native code will + * trigger expensive native to Java transitions. So the preferred + * setting for production use is either + * {@link org.rocksdb.InfoLogLevel#ERROR_LEVEL} or + * {@link org.rocksdb.InfoLogLevel#FATAL_LEVEL}. + *

*/ public abstract class Logger extends RocksObject {