parent
1445286346
commit
f4d347171e
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.autoupdate;
|
||||
|
||||
import com.devexperts.logging.FileLogger;
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.core.FindFileHelper;
|
||||
import com.rusefi.core.io.BundleUtil;
|
||||
|
@ -50,6 +51,7 @@ public class Autoupdate {
|
|||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileLogger.init();
|
||||
autoupdate(args);
|
||||
} catch (Throwable e) {
|
||||
log.error("Autoupdate Error", e);
|
||||
|
@ -71,7 +73,7 @@ public class Autoupdate {
|
|||
private static void autoupdate(String[] args) {
|
||||
String bundleFullName = BundleUtil.readBundleFullName();
|
||||
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);
|
||||
}
|
||||
log.info("Handling parent folder name [" + bundleFullName + "]");
|
||||
|
|
|
@ -11,7 +11,17 @@ public class FileLogger {
|
|||
public static final String DATE_PATTERN = "yyyy-MM-dd_HH_mm_ss_SSS";
|
||||
|
||||
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() {
|
||||
|
@ -22,6 +32,7 @@ public class FileLogger {
|
|||
File dir = new File(DIR);
|
||||
if (dir.exists())
|
||||
return;
|
||||
System.out.println("Creating " + DIR);
|
||||
boolean created = dir.mkdirs();
|
||||
if (!created)
|
||||
throw new IllegalStateException("Failed to create " + DIR + " folder");
|
||||
|
|
|
@ -123,14 +123,4 @@ public enum FileLog {
|
|||
OutputStreamWriter os = new OutputStreamWriter(fileLog);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.FileLogger;
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.core.rusEFIVersion;
|
||||
import com.rusefi.tools.ConsoleTools;
|
||||
|
@ -31,6 +32,7 @@ public class Launcher implements rusEFIVersion {
|
|||
* @see StartupFrame if no parameters specified
|
||||
*/
|
||||
public static void main(final String[] args) throws Exception {
|
||||
FileLogger.init();
|
||||
log.info("rusEFI UI console " + CONSOLE_VERSION);
|
||||
log.info("Compiled " + new Date(rusEFIVersion.classBuildTimeMillis()));
|
||||
log.info("\n\n");
|
||||
|
|
Loading…
Reference in New Issue