From ea1eaa0856632070812c8008b8abf59a1c667e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sj=C3=B6l=C3=A9n?= Date: Thu, 6 Feb 2025 21:56:41 +0100 Subject: [PATCH] Print a file-local message when starting logging --- src/hotspot/share/logging/logFileOutput.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/hotspot/share/logging/logFileOutput.cpp b/src/hotspot/share/logging/logFileOutput.cpp index f73a8c44173d7..e94cd2e3c1358 100644 --- a/src/hotspot/share/logging/logFileOutput.cpp +++ b/src/hotspot/share/logging/logFileOutput.cpp @@ -250,6 +250,20 @@ bool LogFileOutput::initialize(const char* options, outputStream* errstream) { os::ftruncate(os::get_fileno(_stream), 0); } + { // Produce a file-unique rotation message. + LogTagSet& tagset = LogTagSetMapping::tagset(); + LogLevelType level = tagset.level_for(this); + if (level >= LogLevelType::Info) { + LogDecorations decorations(LogLevel::Info, tagset, tagset.decorators()); + + stringStream st(os::iso8601_timestamp_size); + char buf[os::iso8601_timestamp_size]; + char* result = os::iso8601_time(os::javaTimeMillis(), buf, os::iso8601_timestamp_size, true); + st.print("Started logging for file at %s", result); + this->write_internal(decorations, st.freeze()); + } + } + return true; }