Use a property name that does not imply it is only about tasks logging

When indeed it is not only about those.
This commit is contained in:
Baptiste Mathus committed 2018-03-27 14:42:59 +02:00
1 parent 34f9586f5e
commit c50d808de1
2 files changed
+7 -7

No files matched your search

@@ -52,11 +52,11 @@ import org.acegisecurity.context.SecurityContextHolder;
public abstract class SafeTimerTask extends TimerTask {
/**
* System property to change the location where tasks logging should be sent.
* System property to change the location where (tasks) logging should be sent.
* <p><strong>Beware: changing it while Jenkins is running gives no guarantee logs will be sent to the new location
* until it is restarted.</strong></p>
*/
static final String TASKS_LOGS_ROOT_PATH_PROPERTY = SafeTimerTask.class.getName()+".TASKS_LOGS_ROOT_PATH";
static final String LOGS_ROOT_PATH_PROPERTY = SafeTimerTask.class.getName()+".logsTargetDir";
public final void run() {
// background activity gets system credential,
@@ -83,13 +83,13 @@ public abstract class SafeTimerTask extends TimerTask {
* @since TODO
*/
public static File getLogsRoot() {
String tagsLogsPath = SystemProperties.getString(TASKS_LOGS_ROOT_PATH_PROPERTY);
String tagsLogsPath = SystemProperties.getString(LOGS_ROOT_PATH_PROPERTY);
if (tagsLogsPath == null) {
return new File(Jenkins.get().getRootDir(), "logs");
} else {
LOGGER.log(Level.INFO,
"Using non default root path for tasks logging: {0}. (Beware: no automated migration if you change or remove it again)",
TASKS_LOGS_ROOT_PATH_PROPERTY);
LOGS_ROOT_PATH_PROPERTY);
return new File(tagsLogsPath);
}
}
@@ -31,13 +31,13 @@ public class SafeTimerTaskTest {
@After
public void tearDown() throws Exception {
System.clearProperty(SafeTimerTask.TASKS_LOGS_ROOT_PATH_PROPERTY);
System.clearProperty(SafeTimerTask.LOGS_ROOT_PATH_PROPERTY);
}
@Issue("JENKINS-50291")
@Test
public void changeLogsRoot() throws Exception {
assertNull(System.getProperty(SafeTimerTask.TASKS_LOGS_ROOT_PATH_PROPERTY));
assertNull(System.getProperty(SafeTimerTask.LOGS_ROOT_PATH_PROPERTY));
File temporaryFolder = folder.newFolder();
@@ -50,7 +50,7 @@ public class SafeTimerTaskTest {
assertTrue(logsRoot.exists());
assertTrue(logsRoot.isDirectory());
System.setProperty(SafeTimerTask.TASKS_LOGS_ROOT_PATH_PROPERTY, temporaryFolder.toString());
System.setProperty(SafeTimerTask.LOGS_ROOT_PATH_PROPERTY, temporaryFolder.toString());
assertEquals(temporaryFolder.toString(), SafeTimerTask.getLogsRoot().toString());
}