Skip to content

Commit 6eeb241

Browse files
ivbergankitm3k
authored andcommitted
Revert to err logging instead of LOGS_DEFAULT macro (microsoft#22720)
Revert to err logging instead of LOGS_DEFAULT macro due to issue seen during testing. "onnxruntime::logging::LoggingManager::DefaultLogger Attempt to use DefaultLogger but none has been registered." ### Description Revert part of PR suggestion to prevent crash for scenario seen in microsoft#22699. Previously we had tested w/o this macro ### Motivation and Context Previous PR microsoft#22699 it was suggested to use LOGS_DEFAULT() but that does not work during early init. Safer to use std::cerr instead like the original PR had it.
1 parent 7959726 commit 6eeb241

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

onnxruntime/core/platform/windows/logging/etw_sink.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ void EtwRegistrationManager::LazyInitialize() {
160160
if (FAILED(etw_status_)) {
161161
// Registration can fail when running under Low Integrity process, and should be non-fatal
162162
initialization_status_ = InitializationStatus::Failed;
163-
LOGS_DEFAULT(WARNING) << "Error in ETW registration: " << std::to_string(etw_status_);
163+
// Injection of ETW logger can happen very early if ETW provider was already listening.
164+
// Don't use LOGS_DEFAULT here or can get "Attempt to use DefaultLogger but none has been registered"
165+
std::cerr << "Error in ETW registration: " << std::to_string(etw_status_) << std::endl;
164166
}
165167
initialization_status_ = InitializationStatus::Initialized;
166168
}

0 commit comments

Comments
 (0)