Navigation Menu

Skip to content

Commit

Permalink
[JENKINS-50291] Adjust to new logs root location
Browse files Browse the repository at this point in the history
  • Loading branch information
batmat committed Apr 5, 2018
1 parent c0dc007 commit 1c838cc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/jenkins/metrics/api/Metrics.java
Expand Up @@ -47,11 +47,14 @@
import hudson.security.Permission;
import hudson.security.PermissionGroup;
import hudson.security.PermissionScope;
import hudson.triggers.SafeTimerTask;
import hudson.util.PluginServletFilter;
import hudson.util.StreamTaskListener;
import hudson.util.TimeUnit2;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -595,6 +598,20 @@ public void run() {
/* package */
static File getLogFile(Jenkins jenkins) {
File logsRoot = new File(jenkins.getRootDir(), "logs");
try {
// FIXME : remove when 2.114+ See JENKINS-50291
final Method getLogsRoot = SafeTimerTask.class.getMethod("getLogsRoot");
logsRoot = (File) getLogsRoot.invoke(null);

} catch (NoSuchMethodException e) {
// Expected on < 2.114
} catch (IllegalAccessException e) {
e.printStackTrace();
// Expected on < 2.114
} catch (InvocationTargetException e) {
e.printStackTrace();
// Expected on < 2.114
}
return new File(logsRoot, "health-checker.log");
}

Expand Down

0 comments on commit 1c838cc

Please sign in to comment.