Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.cc uses old protobuf log handling API that was removed in protobuf 22.0 #225

Open
jvvv opened this issue Oct 16, 2023 · 1 comment

Comments

@jvvv
Copy link
Contributor

jvvv commented Oct 16, 2023

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?

@jvvv
Copy link
Contributor Author

jvvv commented Oct 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant