Skip to content

Commit 8eb2133

Browse files
committed
improved log messages
1 parent 38a9204 commit 8eb2133

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Diff for: core/src/main/java/com/cloud/storage/template/SwiftVolumeDownloader.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public long download(boolean resume, DownloadCompleteCallback callback) {
237237
return 0;
238238
}
239239

240-
LOGGER.info("Starting download from " + downloadUrl + " to staging with size " + remoteSize + " bytes to "+filePath);
240+
LOGGER.info("Starting download from " + downloadUrl + " to staging with size " + remoteSize + " bytes to " + srcFile.getPath());
241241
final Date downloadStart = new Date();
242242

243243
try (FileOutputStream fileOutputStream = new FileOutputStream(srcFile);) {
@@ -257,7 +257,8 @@ public long download(boolean resume, DownloadCompleteCallback callback) {
257257
outputStream.close();
258258
inputStream.close();
259259
} catch (IOException e) {
260-
LOGGER.error("Exception when downloading from url to staging nfs:" + e.getMessage(), e);
260+
LOGGER.error("Exception when downloading from url " + downloadUrl + " with remote size " + remoteSize
261+
+ " to staging nfs path " + srcFile.getPath() + " : " + e.getMessage(), e);
261262
status = Status.RECOVERABLE_ERROR;
262263
return 0;
263264
}

Diff for: plugins/storage/image/swift/src/main/java/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCal
116116
}
117117

118118
if (downloadCommand == null){
119-
String errMsg = "Unable to build download command, DataObject is of neither VOLUME or TEMPLATE type";
119+
String errMsg = "Unable to build download command, unsupported DataObject is of type " + data.getType().toString();
120120
s_logger.error(errMsg);
121121
throw new CloudRuntimeException(errMsg);
122122
}

Diff for: services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1167,11 +1167,12 @@ protected File downloadFromUrlToNfs(String url, NfsTO nfs, String path, String n
11671167
try (FileOutputStream outputStream = new FileOutputStream(destFile);) {
11681168
entity.writeTo(outputStream);
11691169
} catch (IOException e) {
1170-
s_logger.error("downloadFromUrlToNfs:Exception:" + e.getMessage(), e);
1170+
s_logger.error(String.format("Unable to download from url [%s] to nfs path [%s] due to [%s]",
1171+
url,destFile.getPath(),e.getMessage()), e);
11711172
}
11721173
return new File(destFile.getAbsolutePath());
11731174
} catch (IOException e) {
1174-
s_logger.error("Faild to get url:" + url + ", due to " + e.toString());
1175+
s_logger.error("Failed to get url:" + url + ", due to " + e.toString(), e);
11751176
throw new CloudRuntimeException(e);
11761177
}
11771178
}
@@ -1210,7 +1211,7 @@ protected Answer registerTemplateOnSwift(DownloadCommand cmd) {
12101211
try (FileInputStream fs = new FileInputStream(file)) {
12111212
md5sum = DigestUtils.md5Hex(fs);
12121213
} catch (IOException e) {
1213-
s_logger.error("Failed to get md5sum: " + file.getAbsoluteFile());
1214+
s_logger.error("Failed to get md5sum: " + file.getAbsoluteFile(), e);
12141215
}
12151216

12161217
DownloadAnswer answer = new DownloadAnswer(null, 100, null, VMTemplateStorageResourceAssoc.Status.DOWNLOADED, swiftPath, swiftPath, virtualSize, file.length(), md5sum);

0 commit comments

Comments
 (0)