outFile.delete();
}
AEDiagnostics.flushPendingLogs();
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFile));
// %USERDIR%\logs
File logPath = new File(SystemProperties.getUserPath(), "logs");
File[] files = logPath.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().endsWith(".log");
}
});
addFilesToZip(out, files);
// %USERDIR%
File userPath = new File(SystemProperties.getUserPath());
files = userPath.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().endsWith(".log");
}
});
addFilesToZip(out, files);
// %USERDIR%\debug
files = path.listFiles();
addFilesToZip(out, files);
// recent errors from exe dir
final long ago = SystemTime.getCurrentTime() - 1000L * 60 * 60 * 24 * 90;
File azureusPath = new File(SystemProperties.getApplicationPath());
files = azureusPath.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return (pathname.getName().startsWith("hs_err") && pathname.lastModified() > ago);
}
});
addFilesToZip(out, files);
// recent errors from OSX java log dir
File javaLogPath = new File(System.getProperty("user.home"), "Library"
+ File.separator + "Logs" + File.separator + "Java");
if (javaLogPath.isDirectory()) {
files = javaLogPath.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return (pathname.getName().endsWith("log") && pathname.lastModified() > ago);
}
});
addFilesToZip(out, files);
}
// recent OSX crashes
File diagReportspath = new File(System.getProperty("user.home"), "Library"
+ File.separator + "Logs" + File.separator + "DiagnosticReports");
if (diagReportspath.isDirectory()) {
files = diagReportspath.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return (pathname.getName().endsWith("crash") && pathname.lastModified() > ago);
}
});
addFilesToZip(out, files);
}
boolean bLogToFile = COConfigurationManager.getBooleanParameter("Logging Enable");
String sLogDir = COConfigurationManager.getStringParameter("Logging Dir",
"");
if (bLogToFile && sLogDir != null) {
File loggingFile = new File(sLogDir, FileLogging.LOG_FILE_NAME);
if (loggingFile.isFile()) {
addFilesToZip(out, new File[] {
loggingFile
});
}
}
if (extraLogDirs != null) {
for (File file : extraLogDirs) {
files = file.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().endsWith("stackdump")
|| pathname.getName().endsWith("log");
}
});
addFilesToZip(out, files);
}
}
out.close();
if (outFile.exists()) {
gr.file = outFile;
return gr;
}