合并MpAPP和运维日志的上传

hdrplus
Matthew 12 months ago
parent 32218364d3
commit b75e072e66

@ -28,6 +28,23 @@ public class ZipUtils {
}
}
public static void ZipFolders(List<File> srcFiles, File zipFile, Filter filter) {
try {
ZipOutputStream outZip = new ZipOutputStream(new FileOutputStream(zipFile));
for (File srcFile : srcFiles) {
ZipFiles(srcFile.getParent() + File.separator, srcFile.getName(), outZip, filter);
}
outZip.finish();
outZip.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
private static void ZipFiles(String srcFileParentName, String srcFileName, ZipOutputStream zipOutputSteam, Filter filter) throws Exception {
if (zipOutputSteam == null)
return;

@ -493,7 +493,7 @@ public class AppMaster {
mService.logger.warning("Recv Upload Log" + url);
int noSpecData = jsonObject.optInt("noSpecData", 0);
uploadLogs(url, noSpecData == 0);
uploadMasterLogs(url);
// uploadMasterLogs(url);
} else if (TextUtils.equals(cmd, CMD_SET_CMA)) {
String ip = jsonObject.optString("value_str", null);
int port = jsonObject.optInt("value_int", 0);
@ -870,6 +870,15 @@ public class AppMaster {
return;
}
List<File> folders = new ArrayList<>();
folders.add(logDir);
final String masterAppDir = MicroPhotoContext.buildMasterAppDir(mService.getApplicationContext());
final File mlogDir = new File(masterAppDir + "logs" + File.separator);
if (logDir.exists()) {
folders.add(mlogDir);
}
ZipUtils.Filter filter = new ZipUtils.Filter() {
@Override
public boolean match(String fileName) {
@ -882,7 +891,8 @@ public class AppMaster {
return true;
}
};
ZipUtils.ZipFolder(logDir, file, filter);
ZipUtils.ZipFolders(folders, file, filter);
if (!file.exists()) {
return;

Loading…
Cancel
Save