Skip to content

Commit

Permalink
Print a file-local message when starting logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jdksjolen committed Feb 6, 2025
1 parent ae5ac77 commit ea1eaa0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/hotspot/share/logging/logFileOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LOG_TAGS(logging)>::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;
}

Expand Down

0 comments on commit ea1eaa0

Please sign in to comment.