提交 b12b1694 编写于 作者: O Oliver Gondža

Expose SlaveComputer#getLogDir() explicitly

上级 733f0911
......@@ -271,14 +271,25 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
/**
* This is where the log from the remote agent goes.
* The method also creates a log directory if required.
* @see #relocateOldLogs()
* @see #getLogDir(), #relocateOldLogs()
*/
public File getLogFile() {
public @Nonnull File getLogFile() {
return new File(getLogDir(),"slave.log");
}
/**
* Directory where rotated slave logs are stored.
*
* The method also creates a log directory if required.
*
* @since TODO
*/
protected @Nonnull File getLogDir() {
File dir = new File(Jenkins.getInstance().getRootDir(),"logs/slaves/"+nodeName);
if (!dir.exists() && !dir.mkdirs()) {
LOGGER.severe("Failed to create slave log directory " + dir.getAbsolutePath());
}
return new File(dir,"slave.log");
return dir;
}
/**
......
......@@ -657,7 +657,7 @@ public class SlaveComputer extends Computer {
IOUtils.closeQuietly(log);
try {
Util.deleteRecursive(getLogFile().getParentFile());
Util.deleteRecursive(getLogDir());
} catch (IOException ex) {
logger.log(Level.WARNING, "Unable to delete slave logs", ex);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册