Skip to content
Permalink
Browse files

Merge pull request #3382 from batmat/JENKINS-50291-followup

Log the message only once in INFO level
  • Loading branch information...
batmat committed Apr 8, 2018
2 parents 70c408c + 75df729 commit d366abc1d7b2a96a4ebd3acf44d5c812a4246d48
Showing with 12 additions and 1 deletion.
  1. +12 −1 core/src/main/java/hudson/triggers/SafeTimerTask.java
@@ -58,6 +58,12 @@
*/
static final String LOGS_ROOT_PATH_PROPERTY = SafeTimerTask.class.getName()+".logsTargetDir";

/**
* Local marker to know if the information about using non default root directory for logs has already been logged at least once.
* @see #LOGS_ROOT_PATH_PROPERTY
*/
private static boolean ALREADY_LOGGED = false;

public final void run() {
// background activity gets system credential,
// just like executors get it.
@@ -87,9 +93,14 @@ public static File getLogsRoot() {
if (tagsLogsPath == null) {
return new File(Jenkins.get().getRootDir(), "logs");
} else {
LOGGER.log(Level.INFO,
Level logLevel = Level.INFO;
if (ALREADY_LOGGED) {
logLevel = Level.FINE;
}
LOGGER.log(logLevel,
"Using non default root path for tasks logging: {0}. (Beware: no automated migration if you change or remove it again)",
LOGS_ROOT_PATH_PROPERTY);
ALREADY_LOGGED = true;
return new File(tagsLogsPath);
}
}

0 comments on commit d366abc

Please sign in to comment.
You can’t perform that action at this time.