config.cc uses old protobuf log handling API that was removed in protobuf 22.0
jvvv opened this issue · 1 comments
On Alpine Linux, we are using the following patch to work around build errors since building with more recent protobuf (> 21.12):
diff --git a/config.cc b/config.cc
index 0148ab2..7f0b4d7 100644
--- a/config.cc
+++ b/config.cc
@@ -302,11 +302,6 @@ static bool parseInternal(nsjconf_t* nsjconf, const nsjail::NsJailConfig& njc) {
return true;
}
-static void logHandler(
- google::protobuf::LogLevel level, const char* filename, int line, const std::string& message) {
- LOG_W("config.cc: '%s'", message.c_str());
-}
-
bool parseFile(nsjconf_t* nsjconf, const char* file) {
LOG_D("Parsing configuration from '%s'", file);
@@ -316,7 +311,6 @@ bool parseFile(nsjconf_t* nsjconf, const char* file) {
return false;
}
- SetLogHandler(logHandler);
google::protobuf::io::FileInputStream input(fd);
input.SetCloseOnDelete(true);
Between protobuf releases 21.12 and 22.0, the LogHandler interface was removed. If I understood some of what I read, then functionality was replaced by abseil interfaces, but I am not certain that I have the full grasp of all the changes. Protobuf seems to be a fast moving target. I am wondering if there is any intention to catch up with current protobuf?
I haven't found a one-to-one (not even a one-off) replacement for SetLogHandler in newer protobuf, nor in abseil-cpp. So far, the most promising option l have found is absl::LogSink. Still looking into it.
xls/common/logging looks to be fairly thorough handling of logging with abseil-cpp interfaces and also utilizes LogSink to handle logging to other that stdout/stderr. Will study that as well as read more docs on abseil-cpp and protobuf.