-
Notifications
You must be signed in to change notification settings - Fork 75.3k
TF_RegisterLogListener in C API does not seem to work #44995
Copy link
Copy link
Closed
Labels
TF 2.3Issues related to TF 2.3Issues related to TF 2.3comp:runtimec++ runtime, performance issues (cpu)c++ runtime, performance issues (cpu)staleThis label marks the issue/pr stale - to be closed automatically if no activityThis label marks the issue/pr stale - to be closed automatically if no activitystat:awaiting responseStatus - Awaiting response from authorStatus - Awaiting response from authortype:bugBugBug
Metadata
Metadata
Assignees
Labels
TF 2.3Issues related to TF 2.3Issues related to TF 2.3comp:runtimec++ runtime, performance issues (cpu)c++ runtime, performance issues (cpu)staleThis label marks the issue/pr stale - to be closed automatically if no activityThis label marks the issue/pr stale - to be closed automatically if no activitystat:awaiting responseStatus - Awaiting response from authorStatus - Awaiting response from authortype:bugBugBug
System information
Describe the current behavior
When I call TF_RegisterLogListener in the C API, it doesn't seem to work as described. My listener is never called, and TensorFlow log messages still go to the console. The API description is:
// Register a listener method that processes printed messages.
//
// If any listeners are registered, the print operator will call all listeners
// with the printed messages and immediately return without writing to the
// logs.
Describe the expected behavior
My listener should be called and the messages should not be written to the console.
Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/Jupyter/any notebook.
extern "C"
{
void logListener(const char *message)
{
// This is never called and TensorFlow log messages go to the console instead.
std::cout << "TensorFlow: " << message << std::endl;
}
}
TF_RegisterLogListener(logListener);
Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.