trying to preserver the error

only: proteus_f7
This commit is contained in:
rusefillc 2024-08-08 19:26:30 -04:00
parent 1445286346
commit f4d347171e
4 changed files with 17 additions and 12 deletions

View File

@ -1,5 +1,6 @@
package com.rusefi.autoupdate; package com.rusefi.autoupdate;
import com.devexperts.logging.FileLogger;
import com.devexperts.logging.Logging; import com.devexperts.logging.Logging;
import com.rusefi.core.FindFileHelper; import com.rusefi.core.FindFileHelper;
import com.rusefi.core.io.BundleUtil; import com.rusefi.core.io.BundleUtil;
@ -50,6 +51,7 @@ public class Autoupdate {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
FileLogger.init();
autoupdate(args); autoupdate(args);
} catch (Throwable e) { } catch (Throwable e) {
log.error("Autoupdate Error", e); log.error("Autoupdate Error", e);
@ -71,7 +73,7 @@ public class Autoupdate {
private static void autoupdate(String[] args) { private static void autoupdate(String[] args) {
String bundleFullName = BundleUtil.readBundleFullName(); String bundleFullName = BundleUtil.readBundleFullName();
if (bundleFullName == null) { if (bundleFullName == null) {
log.error("ERROR: Autoupdate: unable to perform without bundleFullName (parent folder name)"); log.error("ERROR: Autoupdate: unable to perform without bundleFullName (check parent folder name)");
System.exit(-1); System.exit(-1);
} }
log.info("Handling parent folder name [" + bundleFullName + "]"); log.info("Handling parent folder name [" + bundleFullName + "]");

View File

@ -11,7 +11,17 @@ public class FileLogger {
public static final String DATE_PATTERN = "yyyy-MM-dd_HH_mm_ss_SSS"; public static final String DATE_PATTERN = "yyyy-MM-dd_HH_mm_ss_SSS";
static { static {
Logging.configureLogFile(FileLogger.DIR + "efi_log_" + date + ".log"); try {
FileLogger.createFolderIfNeeded();
Logging.configureLogFile(FileLogger.DIR + "efi_log_" + date + ".log");
} catch (Throwable e) {
e.printStackTrace(System.err);
System.err.println("Error starting logging" + e);
}
}
public static void init() {
// just need to touch the class
} }
public static String getDate() { public static String getDate() {
@ -22,6 +32,7 @@ public class FileLogger {
File dir = new File(DIR); File dir = new File(DIR);
if (dir.exists()) if (dir.exists())
return; return;
System.out.println("Creating " + DIR);
boolean created = dir.mkdirs(); boolean created = dir.mkdirs();
if (!created) if (!created)
throw new IllegalStateException("Failed to create " + DIR + " folder"); throw new IllegalStateException("Failed to create " + DIR + " folder");

View File

@ -123,14 +123,4 @@ public enum FileLog {
OutputStreamWriter os = new OutputStreamWriter(fileLog); OutputStreamWriter os = new OutputStreamWriter(fileLog);
exception.printStackTrace(new PrintWriter(os)); exception.printStackTrace(new PrintWriter(os));
} }
public void logException(String msg, Throwable e) {
logLine(msg + e);
e.printStackTrace();
if (fileLog == null) {
JOptionPane.showConfirmDialog(null, msg + " " + e, "no log and Exception Occurred", JOptionPane.DEFAULT_OPTION);
return;
}
log(e);
}
} }

View File

@ -1,5 +1,6 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.FileLogger;
import com.devexperts.logging.Logging; import com.devexperts.logging.Logging;
import com.rusefi.core.rusEFIVersion; import com.rusefi.core.rusEFIVersion;
import com.rusefi.tools.ConsoleTools; import com.rusefi.tools.ConsoleTools;
@ -31,6 +32,7 @@ public class Launcher implements rusEFIVersion {
* @see StartupFrame if no parameters specified * @see StartupFrame if no parameters specified
*/ */
public static void main(final String[] args) throws Exception { public static void main(final String[] args) throws Exception {
FileLogger.init();
log.info("rusEFI UI console " + CONSOLE_VERSION); log.info("rusEFI UI console " + CONSOLE_VERSION);
log.info("Compiled " + new Date(rusEFIVersion.classBuildTimeMillis())); log.info("Compiled " + new Date(rusEFIVersion.classBuildTimeMillis()));
log.info("\n\n"); log.info("\n\n");