vy commented on code in PR #3872:
URL: https://github.com/apache/logging-log4j2/pull/3872#discussion_r2278427921
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java:
##########
@@ -910,23 +910,32 @@ public RollingFileManager createManager(final String
name, final FactoryData dat
}
}
- private static long initialFileTime(final File file) {
+ static long initialFileTime(final File file) {
final Path path = file.toPath();
if (Files.exists(path)) {
try {
final BasicFileAttributes attrs = Files.readAttributes(path,
BasicFileAttributes.class);
final FileTime fileTime = attrs.creationTime();
if (fileTime.compareTo(EPOCH) > 0) {
LOGGER.debug("Returning file creation time for {}",
file.getAbsolutePath());
- return fileTime.toMillis();
+
+ return roundMillis(fileTime.toMillis());
}
- LOGGER.info("Unable to obtain file creation time for " +
file.getAbsolutePath());
+ LOGGER.info("Unable to obtain file creation time for {}",
file.getAbsolutePath());
} catch (final Exception ex) {
- LOGGER.info("Unable to calculate file creation time for " +
file.getAbsolutePath() + ": "
- + ex.getMessage());
+ LOGGER.info(
+ "Unable to calculate file creation time for {}: {}",
file.getAbsolutePath(), ex.getMessage());
}
}
- return file.lastModified();
+
+ return roundMillis(file.lastModified());
+ }
+
+ /**
+ * @see <a
href="https://github.com/apache/logging-log4j2/issues/3068">Issue #3068</a>
+ */
+ static long roundMillis(long millis) {
Review Comment:
Nit: Would you mind renaming this to `roundMillisToSeconds`, please? The
round target is implicit and not clear in the current footprint.
```suggestion
static long roundMillis(long millis) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]