Skip to content

Commit

Permalink
Only log top level exception on WARNING when deleting
Browse files Browse the repository at this point in the history
Signed-off-by: Raihaan Shouhell <raihaan.shouhell@autodesk.com>
  • Loading branch information
Raihaan Shouhell committed Feb 5, 2020
1 parent a1c604b commit a432d29
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/jenkins/branch/WorkspaceLocatorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,17 @@ public void onOnline(Computer c, TaskListener listener) throws IOException, Inte
try {
child.deleteRecursive();
} catch (IOException x) {
LOGGER.log(Level.WARNING, "could not delete workspace " + child, x);
listener.getLogger().println("could not delete workspace " + child + " , wrong file ownership? Review exception in jenkins log and manually remove the directory");
//Prevent flooding logs if recursive delete fails
if (x.getSuppressed().length != 0) {
IOException e = new IOException(x.getMessage(), x.getCause());
e.setStackTrace(x.getStackTrace());
LOGGER.log(Level.WARNING, "could not delete workspace " + child + " on " + node.getNodeName() + " check finer logs for more information", e);
LOGGER.log(Level.FINE, "could not delete workspace " + child + " on " + node.getNodeName() , x);
} else {
LOGGER.log(Level.WARNING, "could not delete workspace " + child + " on " + node.getNodeName(), x);
}
listener.getLogger().println("could not delete workspace " + child + " on " + node.getNodeName()
+ " , wrong file ownership? Review exception in jenkins log and manually remove the directory");
}
}
}
Expand Down

0 comments on commit a432d29

Please sign in to comment.