From 3ef8063e43640952442de90e034dadba2ada337c Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 29 Apr 2014 12:42:54 -0400 Subject: [PATCH] [JENKINS-22395] Yet more diagnostics. --- core/src/main/java/hudson/model/Run.java | 4 ++-- core/src/main/java/hudson/tasks/LogRotator.java | 2 +- .../main/java/jenkins/model/StandardArtifactManager.java | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index d2701f5d6644..d4ac8e5384b9 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -435,7 +435,7 @@ public void setResult(Result r) { // result can only get worse if (result==null || r.isWorseThan(result)) { result = r; - LOGGER.log(FINE, this + " : result is set to " + r, LOGGER.isLoggable(Level.FINER) ? new Exception() : null); + LOGGER.log(FINE, this + " in " + getRootDir() + ": result is set to " + r, LOGGER.isLoggable(Level.FINER) ? new Exception() : null); } } @@ -1451,7 +1451,7 @@ public synchronized void deleteArtifacts() throws IOException { public void delete() throws IOException { File rootDir = getRootDir(); if (!rootDir.isDirectory()) { - throw new IOException(this + ": " + rootDir + " looks to have already been deleted"); + throw new IOException(this + ": " + rootDir + " looks to have already been deleted; siblings: " + Arrays.toString(project.getBuildDir().list())); } RunListener.fireDeleted(this); diff --git a/core/src/main/java/hudson/tasks/LogRotator.java b/core/src/main/java/hudson/tasks/LogRotator.java index 17f16abf0b61..bc7a2d97383e 100644 --- a/core/src/main/java/hudson/tasks/LogRotator.java +++ b/core/src/main/java/hudson/tasks/LogRotator.java @@ -108,7 +108,7 @@ public LogRotator(int daysToKeep, int numToKeep, int artifactDaysToKeep, int art @SuppressWarnings("rawtypes") public void perform(Job job) throws IOException, InterruptedException { - LOGGER.log(FINE, "Running the log rotation for {0}", job); + LOGGER.log(FINE, "Running the log rotation for {0} with numToKeep={1} daysToKeep={2} artifactNumToKeep={3} artifactDaysToKeep={4}", new Object[] {job, numToKeep, daysToKeep, artifactNumToKeep, artifactDaysToKeep}); // always keep the last successful and the last stable builds Run lsb = job.getLastSuccessfulBuild(); diff --git a/core/src/main/java/jenkins/model/StandardArtifactManager.java b/core/src/main/java/jenkins/model/StandardArtifactManager.java index 1716158e2113..a4f8b9df8d84 100644 --- a/core/src/main/java/jenkins/model/StandardArtifactManager.java +++ b/core/src/main/java/jenkins/model/StandardArtifactManager.java @@ -32,6 +32,8 @@ import java.io.File; import java.io.IOException; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import jenkins.util.VirtualFile; /** @@ -41,6 +43,8 @@ */ public class StandardArtifactManager extends ArtifactManager { + private static final Logger LOG = Logger.getLogger(StandardArtifactManager.class.getName()); + protected transient Run build; public StandardArtifactManager(Run build) { @@ -60,8 +64,10 @@ public StandardArtifactManager(Run build) { @Override public final boolean delete() throws IOException, InterruptedException { File ad = getArtifactsDir(); if (!ad.exists()) { + LOG.log(Level.FINE, "no such directory {0} to delete for {1}", new Object[] {ad, build}); return false; } + LOG.log(Level.FINE, "deleting {0} for {1}", new Object[] {ad, build}); Util.deleteRecursive(ad); return true; }