Skip to content

Commit

Permalink
Fixed reporting startup time including CLI
Browse files Browse the repository at this point in the history
- depended on WALLCLOCK property formatting, exception is swallowed

Signed-off-by: David Matějček <[email protected]>
  • Loading branch information
dmatej committed Feb 27, 2023
1 parent 537f247 commit 0b71644
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import jakarta.inject.Provider;
import jakarta.inject.Singleton;

import java.time.Duration;
import java.time.Instant;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
Expand Down Expand Up @@ -360,10 +362,10 @@ private boolean postStartupJob() {
if (wallClockStart != null) {
try {
// it will only be set when called from AsadminMain and the env. variable AS_DEBUG is set to true
long realstart = Long.parseLong(wallClockStart);
logger.log(Level.INFO, KernelLoggerInfo.startupTotalTime, (System.currentTimeMillis() - realstart));
}
catch(Exception e) {
Instant realstart = Instant.parse(wallClockStart);
long duration = Duration.between(realstart, Instant.now()).toMillis();
logger.log(Level.INFO, KernelLoggerInfo.startupTotalTime, duration);
} catch(Exception e) {
// do nothing.
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ public static Logger getLogger() {
public static final String startupFailure = LOGMSG_PREFIX + "-00016";

@LogMessageInfo(
message = "{0} startup time: {1} ({2} ms), startup services({3} ms), total({4} ms)",
message = "{0} startup time: {1} ({2} ms), startup services ({3} ms), total ({4} ms)",
level = "INFO")
public static final String startupEndMessage = LOGMSG_PREFIX + "-00017";

@LogMessageInfo(
message = "TOTAL TIME INCLUDING CLI: {0}",
message = "Total startup time including CLI: {0} ms",
level = "INFO")
public static final String startupTotalTime = LOGMSG_PREFIX + "-00018";

Expand Down

0 comments on commit 0b71644

Please sign in to comment.