21 using namespace impala;
23 DEFINE_int32(non_impala_java_vlog, 0,
"(Advanced) The log level (equivalent to --v) for "
24 "non-Impala Java classes (0: INFO, 1 and 2: DEBUG, 3: TRACE)");
29 JNIEXPORT
void JNICALL
31 JNIEnv* env, jclass caller_class,
int severity, jstring msg, jstring file,
35 if (severity == TLogLevel::VLOG && !VLOG_IS_ON(1))
return;
36 if (severity == TLogLevel::VLOG_2 && !VLOG_IS_ON(2))
return;
37 if (severity == TLogLevel::VLOG_3 && !VLOG_IS_ON(3))
return;
41 const char* filename = env->GetStringUTFChars(file, &dummy);
43 if (msg != NULL) str = env->GetStringUTFChars(msg, &dummy);
44 int log_level = google::INFO;
47 case TLogLevel::VLOG_2:
48 case TLogLevel::VLOG_3:
49 log_level = google::INFO;
52 log_level = google::INFO;
55 log_level = google::WARNING;
57 case TLogLevel::ERROR:
58 log_level = google::ERROR;
60 case TLogLevel::FATAL:
61 log_level = google::FATAL;
64 DCHECK(
false) <<
"Unrecognised TLogLevel: " << log_level;
66 google::LogMessage(filename, line_number, log_level).stream() << string(str);
67 if (msg != NULL) env->ReleaseStringUTFChars(msg, str);
68 env->ReleaseStringUTFChars(file, filename);
76 jclass native_backend_cl = env->FindClass(
"com/cloudera/impala/util/NativeLogger");
77 nm.name =
const_cast<char*
>(
"Log");
78 nm.signature =
const_cast<char*
>(
"(ILjava/lang/String;Ljava/lang/String;I)V");
80 env->RegisterNatives(native_backend_cl, &nm, 1);
86 case 0:
return TLogLevel::INFO;
87 case 1:
return TLogLevel::VLOG;
88 case 2:
return TLogLevel::VLOG_2;
90 default:
return TLogLevel::VLOG_3;
TLogLevel::type FlagToTLogLevel(int flag)
JNIEXPORT void JNICALL Java_com_cloudera_impala_util_NativeLogger_Log(JNIEnv *env, jclass caller_class, int severity, jstring msg, jstring file, int line_number)
void InitJvmLoggingSupport()
DEFINE_int32(periodic_counter_update_period_ms, 500,"Period to update rate counters and"" sampling counters in ms")
JNIEnv * getJNIEnv(void)
C linkage for helper functions in hdfsJniHelper.h.