Java API - Add missing HEADER_LEVEL logging (#1104)

main
Adam Retter 9 years ago committed by Yueh-Hsuan Chiang
parent 4d02bfa3a6
commit 72c73cdc8b
  1. 3
      java/rocksjni/loggerjnicallback.cc
  2. 9
      java/rocksjni/portal.h
  3. 3
      java/src/main/java/org/rocksdb/InfoLogLevel.java

@ -60,6 +60,9 @@ void LoggerJniCallback::Logv(const InfoLogLevel log_level,
case rocksdb::InfoLogLevel::FATAL_LEVEL:
jlog_level = InfoLogLevelJni::FATAL_LEVEL(env);
break;
case rocksdb::InfoLogLevel::HEADER_LEVEL:
jlog_level = InfoLogLevelJni::HEADER_LEVEL(env);
break;
default:
jlog_level = InfoLogLevelJni::FATAL_LEVEL(env);
break;

@ -676,15 +676,20 @@ class InfoLogLevelJni {
return getEnum(env, "FATAL_LEVEL");
}
// Get the HEADER_LEVEL enum field of org.rocksdb.InfoLogLevel
static jobject HEADER_LEVEL(JNIEnv* env) {
return getEnum(env, "HEADER_LEVEL");
}
private:
// Get the java class id of org.rocksdb.WBWIRocksIterator.WriteType.
// Get the java class id of org.rocksdb.InfoLogLevel
static jclass getJClass(JNIEnv* env) {
jclass jclazz = env->FindClass("org/rocksdb/InfoLogLevel");
assert(jclazz != nullptr);
return jclazz;
}
// Get an enum field of org.rocksdb.WBWIRocksIterator.WriteType
// Get an enum field of org.rocksdb.InfoLogLevel
static jobject getEnum(JNIEnv* env, const char name[]) {
jclass jclazz = getJClass(env);
jfieldID jfid =

@ -9,7 +9,8 @@ public enum InfoLogLevel {
WARN_LEVEL((byte)2),
ERROR_LEVEL((byte)3),
FATAL_LEVEL((byte)4),
NUM_INFO_LOG_LEVELS((byte)5);
HEADER_LEVEL((byte)5),
NUM_INFO_LOG_LEVELS((byte)6);
private final byte value_;

Loading…
Cancel
Save