kudu
kudu copied to clipboard
logging: We should initialized logging BEFORE InstallLoggingCallback,…
… otherwise the programming will abort(CHECKED(logging_initialized)).
This commit shouldn't be necessary; see this code in client.cc:
// We need to reroute all logging to stderr when the client library is
// loaded. GoogleOnceInit() can do that, but there are multiple entry
// points into the client code, and it'd need to be called in each one.
// So instead, let's use a constructor function.
//
// This is restricted to the exported client builds only. In case of linking
// with non-exported kudu client library, logging must be initialized
// from the main() function of the corresponding binary: usually, that's done
// by calling InitGoogleLoggingSafe(argv[0]).
__attribute__((constructor))
static void InitializeBasicLogging() {
InitGoogleLoggingSafeBasic(kProgName);
SetVerboseLevelFromEnvVar();
}
That gets run when libkudu_client.so is loaded at runtime, which is usually one of the first things done by an executable that dynamically links against libkudu_client.so, certainly before main() is run.
What's the complete stack trace on error? Are you building example.cc in some non-standard way?