parent
80b227b2fa
commit
f25772dc7d
|
@ -0,0 +1,78 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.FileLogger;
|
||||
import com.opensr5.Logger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public enum AutotestLogging {
|
||||
INSTANCE;
|
||||
|
||||
public static String currentLogName;
|
||||
|
||||
@Nullable
|
||||
private OutputStream fileLog; // null if not opened yet or already closed
|
||||
public static boolean suspendLogging;
|
||||
|
||||
|
||||
public synchronized void logLine(String fullLine) {
|
||||
String withDate = FileLog.getDate() + Logger.END_OF_TIMESTAND_TAG + fullLine;
|
||||
System.out.println(withDate);
|
||||
if (suspendLogging)
|
||||
return;
|
||||
if (fileLog == null)
|
||||
return;
|
||||
try {
|
||||
fileLog.write((withDate + "\r\n").getBytes());
|
||||
fileLog.flush();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private FileOutputStream openLog() throws FileNotFoundException {
|
||||
FileLogger.createFolderIfNeeded();
|
||||
String shortFileName = name() + "_rfi_report_" + FileLogger.date;
|
||||
currentLogName = shortFileName + ".csv";
|
||||
String fullFileName = FileLogger.DIR + currentLogName;
|
||||
rlog("Writing to " + fullFileName);
|
||||
return new FileOutputStream(fullFileName, true);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (fileLog != null)
|
||||
return;
|
||||
try {
|
||||
fileLog = openLog();
|
||||
} catch (FileNotFoundException e) {
|
||||
// Access is denied would be an example of a legit exception to happen here
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
if (fileLog == null)
|
||||
return; // already closed
|
||||
try {
|
||||
rlog("Closing file...");
|
||||
fileLog.close();
|
||||
fileLog = null;
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void rlog(String msg) {
|
||||
System.out.println("rlog " + msg);
|
||||
}
|
||||
|
||||
public void log(Throwable exception) {
|
||||
if (fileLog == null)
|
||||
throw new NullPointerException("fileLog while " + exception);
|
||||
OutputStreamWriter os = new OutputStreamWriter(fileLog);
|
||||
exception.printStackTrace(new PrintWriter(os));
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.autotest.ControllerConnectorState;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.config.generated.Integration;
|
||||
import com.rusefi.enums.engine_type_e;
|
||||
import com.rusefi.functional_tests.EcuTestHelper;
|
||||
|
@ -20,7 +19,7 @@ public class EnduranceTestUtility {
|
|||
public static void main(String[] args) {
|
||||
long start = System.currentTimeMillis();
|
||||
int count = parseCount(args);
|
||||
FileLog.MAIN.logLine("Running " + count + " cycles");
|
||||
AutotestLogging.INSTANCE.logLine("Running " + count + " cycles");
|
||||
try {
|
||||
|
||||
LinkManager linkManager = ControllerConnectorState.getLinkManager();
|
||||
|
@ -35,19 +34,19 @@ public class EnduranceTestUtility {
|
|||
EcuTestHelper.currentEngineType = engine_type_e.DEFAULT_FRANKENSO.ordinal();
|
||||
sendBlockingCommand("set " + Integration.CMD_ENGINE_TYPE + " " + 28, Timeouts.SET_ENGINE_TIMEOUT, commandQueue);
|
||||
sleepSeconds(2);
|
||||
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++");
|
||||
AutotestLogging.INSTANCE.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++");
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
}
|
||||
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ YES YES YES " + count + " +++++++++++++++");
|
||||
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
AutotestLogging.INSTANCE.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
AutotestLogging.INSTANCE.logLine("++++++++++++++++++++++++++++++++++++ YES YES YES " + count + " +++++++++++++++");
|
||||
AutotestLogging.INSTANCE.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
long totalTime = System.currentTimeMillis() - start;
|
||||
long minutes = totalTime / 1000 / 60;
|
||||
FileLog.MAIN.logLine("In " + minutes + " minutes");
|
||||
AutotestLogging.INSTANCE.logLine("In " + minutes + " minutes");
|
||||
}
|
||||
|
||||
private static int parseCount(String[] args) {
|
||||
|
|
|
@ -118,7 +118,7 @@ public class IoUtil {
|
|||
if (!haveResponse)
|
||||
throw new IllegalStateException("No response from simulator");
|
||||
listener.remove();
|
||||
FileLog.MAIN.logLine("Got first signal in " + (System.currentTimeMillis() - waitStart) + "ms");
|
||||
AutotestLogging.INSTANCE.logLine("Got first signal in " + (System.currentTimeMillis() - waitStart) + "ms");
|
||||
}
|
||||
|
||||
public static void connectToSimulator(LinkManager linkManager, boolean startProcess) throws InterruptedException {
|
||||
|
@ -159,7 +159,7 @@ public class IoUtil {
|
|||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public static void sleepSeconds(int seconds) {
|
||||
FileLog.MAIN.logLine("Sleeping " + seconds + " seconds");
|
||||
AutotestLogging.INSTANCE.logLine("Sleeping " + seconds + " seconds");
|
||||
try {
|
||||
Thread.sleep(seconds * 1000L);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
@ -36,14 +36,14 @@ public class SimulatorExecHelper {
|
|||
*/
|
||||
private static void runSimulator(CountDownLatch simulatorStarted) {
|
||||
Thread.currentThread().setName("Main simulation");
|
||||
FileLog.MAIN.logLine("runSimulator...");
|
||||
AutotestLogging.INSTANCE.logLine("runSimulator...");
|
||||
|
||||
try {
|
||||
FileLog.MAIN.logLine("Binary size: " + new File(SIMULATOR_BINARY).length());
|
||||
AutotestLogging.INSTANCE.logLine("Binary size: " + new File(SIMULATOR_BINARY).length());
|
||||
|
||||
FileLog.MAIN.logLine("Executing " + SIMULATOR_BINARY);
|
||||
AutotestLogging.INSTANCE.logLine("Executing " + SIMULATOR_BINARY);
|
||||
simulatorProcess = Runtime.getRuntime().exec(SIMULATOR_BINARY);
|
||||
FileLog.MAIN.logLine("simulatorProcess: " + simulatorProcess);
|
||||
AutotestLogging.INSTANCE.logLine("simulatorProcess: " + simulatorProcess);
|
||||
|
||||
dumpProcessOutput(simulatorProcess, simulatorStarted);
|
||||
} catch (Exception err) {
|
||||
|
@ -55,7 +55,7 @@ public class SimulatorExecHelper {
|
|||
}
|
||||
|
||||
try {
|
||||
FileLog.MAIN.logLine("exitValue: " + simulatorProcess.exitValue());
|
||||
AutotestLogging.INSTANCE.logLine("exitValue: " + simulatorProcess.exitValue());
|
||||
} catch (Exception err) {
|
||||
log.warn("Error reading exit value", err);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class SimulatorExecHelper {
|
|||
String prefix = "ERROR from console: ";
|
||||
Consumer<String> PRINT_AND_LOG = string -> {
|
||||
System.out.println(prefix + string);
|
||||
FileLog.SIMULATOR_CONSOLE.logLine(string);
|
||||
log.info(string);
|
||||
};
|
||||
|
||||
readAndPrint(PRINT_AND_LOG, err);
|
||||
|
@ -111,7 +111,7 @@ public class SimulatorExecHelper {
|
|||
|
||||
static void destroy() {
|
||||
if (simulatorProcess != null) {
|
||||
FileLog.MAIN.logLine("Destroying sub-process...");
|
||||
log.info("Destroying sub-process...");
|
||||
simulatorProcess.destroy();
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class SimulatorExecHelper {
|
|||
public static void startSimulator() throws InterruptedException {
|
||||
if (!new File(SIMULATOR_BINARY).exists())
|
||||
throw new IllegalStateException(SIMULATOR_BINARY + " not found");
|
||||
FileLog.MAIN.logLine("startSimulator...");
|
||||
AutotestLogging.INSTANCE.logLine("startSimulator...");
|
||||
CountDownLatch simulatorStarted = new CountDownLatch(1);
|
||||
new Thread(() -> runSimulator(simulatorStarted), "simulator process").start();
|
||||
simulatorStarted.await(1, TimeUnit.MINUTES);
|
||||
|
|
|
@ -27,8 +27,7 @@ public class SimulatorFunctionalTestLauncher {
|
|||
// }
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
FileLog.SIMULATOR_CONSOLE.start();
|
||||
FileLog.MAIN.start();
|
||||
AutotestLogging.INSTANCE.start();
|
||||
|
||||
boolean failed = false;
|
||||
try {
|
||||
|
@ -45,11 +44,11 @@ public class SimulatorFunctionalTestLauncher {
|
|||
if (failed)
|
||||
System.exit(-1);
|
||||
isHappy = true;
|
||||
FileLog.MAIN.logLine("*******************************************************************************");
|
||||
FileLog.MAIN.logLine("**** SimulatorFunctionalTestLauncher Looks good! *****************************");
|
||||
FileLog.MAIN.logLine("*******************************************************************************");
|
||||
AutotestLogging.INSTANCE.logLine("*******************************************************************************");
|
||||
AutotestLogging.INSTANCE.logLine("**** SimulatorFunctionalTestLauncher Looks good! *****************************");
|
||||
AutotestLogging.INSTANCE.logLine("*******************************************************************************");
|
||||
long time = (System.currentTimeMillis() - start) / 1000;
|
||||
FileLog.MAIN.logLine("Done in " + time + "secs");
|
||||
AutotestLogging.INSTANCE.logLine("Done in " + time + "secs");
|
||||
System.exit(0); // this is a safer method eliminating the issue of non-daemon threads
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.config.generated.Integration;
|
||||
import com.rusefi.core.EngineState;
|
||||
import com.rusefi.functional_tests.EcuTestHelper;
|
||||
|
@ -108,14 +107,14 @@ public class TestingUtils {
|
|||
public static EngineChart nextChart(CommandQueue commandQueue) {
|
||||
long start = System.currentTimeMillis();
|
||||
EngineChart chart = EngineChartParser.unpackToMap(getNextWaveChart(commandQueue));
|
||||
FileLog.MAIN.logLine("AUTOTEST nextChart() in " + (System.currentTimeMillis() - start));
|
||||
AutotestLogging.INSTANCE.logLine("AUTOTEST nextChart() in " + (System.currentTimeMillis() - start));
|
||||
return chart;
|
||||
}
|
||||
|
||||
static String getNextWaveChart(CommandQueue commandQueue) {
|
||||
IoUtil.sendBlockingCommand(Integration.CMD_RESET_ENGINE_SNIFFER, commandQueue);
|
||||
String result = getEngineChart(commandQueue);
|
||||
FileLog.MAIN.logLine("current chart: " + result);
|
||||
AutotestLogging.INSTANCE.logLine("current chart: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -130,7 +129,7 @@ public class TestingUtils {
|
|||
|
||||
final AtomicReference<String> result = new AtomicReference<>();
|
||||
|
||||
FileLog.MAIN.logLine("waiting for next chart");
|
||||
AutotestLogging.INSTANCE.logLine("waiting for next chart");
|
||||
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(Integration.PROTOCOL_ENGINE_SNIFFER, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.autotest;
|
||||
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.AutotestLogging;
|
||||
import com.rusefi.IoUtil;
|
||||
import com.rusefi.TestingUtils;
|
||||
import com.rusefi.autodetect.PortDetector;
|
||||
|
@ -34,7 +34,7 @@ public class ControllerConnectorState {
|
|||
* test exact numbers yet
|
||||
*/
|
||||
TestingUtils.isRealHardware = true;
|
||||
FileLog.MAIN.start();
|
||||
AutotestLogging.INSTANCE.start();
|
||||
|
||||
String port = System.getenv("HARDWARE_CI_SERIAL_DEVICE");
|
||||
if (port == null) {
|
||||
|
|
|
@ -1,34 +1,20 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.FileLogger;
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.opensr5.Logger;
|
||||
import com.rusefi.util.LazyFile;
|
||||
import com.rusefi.util.LazyFileImpl;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* what the hell is this anyway? todo: migrate to log4j2
|
||||
* what the hell is this anyway? rename this utility class?
|
||||
* 6/30/13
|
||||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
*/
|
||||
@Deprecated
|
||||
public enum FileLog {
|
||||
MAIN,
|
||||
SIMULATOR_CONSOLE;
|
||||
public class FileLog {
|
||||
|
||||
public static final String LOG_INFO_TEXT = "Writing logs to '" + FileLogger.DIR + "'";
|
||||
public static final String OS_VERSION = "os.version";
|
||||
public static String currentLogName;
|
||||
|
||||
@Nullable
|
||||
private OutputStream fileLog; // null if not opened yet or already closed
|
||||
public static boolean suspendLogging;
|
||||
|
||||
FileLog() {
|
||||
}
|
||||
|
@ -37,17 +23,6 @@ public enum FileLog {
|
|||
return FileLogger.getDate();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (fileLog != null)
|
||||
return;
|
||||
try {
|
||||
fileLog = openLog();
|
||||
} catch (FileNotFoundException e) {
|
||||
// Access is denied would be an example of a legit exception to happen here
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLinux() {
|
||||
return getOsName().equalsIgnoreCase("Linux");
|
||||
}
|
||||
|
@ -63,52 +38,4 @@ public enum FileLog {
|
|||
public static boolean isWindows() {
|
||||
return getOsName().contains("Windows");
|
||||
}
|
||||
|
||||
private FileOutputStream openLog() throws FileNotFoundException {
|
||||
FileLogger.createFolderIfNeeded();
|
||||
String shortFileName = name() + "_rfi_report_" + FileLogger.date;
|
||||
currentLogName = shortFileName + ".csv";
|
||||
String fullFileName = FileLogger.DIR + currentLogName;
|
||||
rlog("Writing to " + fullFileName);
|
||||
return new FileOutputStream(fullFileName, true);
|
||||
}
|
||||
|
||||
public synchronized void logLine(String fullLine) {
|
||||
String withDate = getDate() + Logger.END_OF_TIMESTAND_TAG + fullLine;
|
||||
System.out.println(withDate);
|
||||
if (suspendLogging)
|
||||
return;
|
||||
if (fileLog == null)
|
||||
return;
|
||||
try {
|
||||
fileLog.write((withDate + "\r\n").getBytes());
|
||||
fileLog.flush();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
if (fileLog == null)
|
||||
return; // already closed
|
||||
try {
|
||||
rlog("Closing file...");
|
||||
fileLog.close();
|
||||
fileLog = null;
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void rlog(String msg) {
|
||||
System.out.println("rlog " + msg);
|
||||
}
|
||||
|
||||
public void log(Throwable exception) {
|
||||
if (fileLog == null)
|
||||
throw new NullPointerException("fileLog while " + exception);
|
||||
OutputStreamWriter os = new OutputStreamWriter(fileLog);
|
||||
exception.printStackTrace(new PrintWriter(os));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import com.rusefi.ui.console.MainFrame;
|
|||
import com.rusefi.ui.console.TabbedPanel;
|
||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||
import com.rusefi.ui.knock.KnockPane;
|
||||
import com.rusefi.ui.logview.LogViewer;
|
||||
import com.rusefi.ui.lua.LuaScriptPanel;
|
||||
import com.rusefi.ui.util.DefaultExceptionHandler;
|
||||
import com.rusefi.ui.util.JustOneInstance;
|
||||
|
@ -95,8 +94,9 @@ public class ConsoleUI {
|
|||
if (!LinkManager.isLogViewerMode(port))
|
||||
engineSnifferPanel.setOutpinListener(uiContext.getLinkManager().getEngineState());
|
||||
|
||||
if (LinkManager.isLogViewerMode(port))
|
||||
tabbedPane.addTab("Log Viewer", new LogViewer(uiContext, engineSnifferPanel));
|
||||
// what is LogViewer? is this all dead?
|
||||
// if (LinkManager.isLogViewerMode(port))
|
||||
// tabbedPane.addTab("Log Viewer", new LogViewer(uiContext, engineSnifferPanel));
|
||||
|
||||
uiContext.DetachedRepositoryINSTANCE.init(getConfig().getRoot().getChild("detached"));
|
||||
uiContext.DetachedRepositoryINSTANCE.load();
|
||||
|
@ -209,7 +209,6 @@ public class ConsoleUI {
|
|||
}
|
||||
|
||||
static void startUi(String[] args) throws InterruptedException, InvocationTargetException {
|
||||
FileLog.MAIN.start();
|
||||
if (ConnectionAndMeta.saveReadmeHtmlToFile()) {
|
||||
new Thread(ConsoleUI::writeReadmeFile).start();
|
||||
}
|
||||
|
@ -218,7 +217,7 @@ public class ConsoleUI {
|
|||
log.info("OS version: " + System.getProperty(FileLog.OS_VERSION));
|
||||
|
||||
getConfig().load();
|
||||
FileLog.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS);
|
||||
AutotestLogging.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS);
|
||||
DefaultExceptionHandler.install();
|
||||
// not very useful? VersionChecker.start();
|
||||
SwingUtilities.invokeAndWait(() -> awtCode(args));
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.tcp.TcpConnector;
|
||||
import com.rusefi.ui.logview.LogViewer;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -11,12 +13,14 @@ import java.io.IOException;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.ui.util.UiUtils.setToolTip;
|
||||
|
||||
public class SimulatorHelper {
|
||||
private final static ThreadFactory THREAD_FACTORY = new NamedThreadFactory("SimulatorHelper");
|
||||
public static final String BINARY = "rusefi_simulator.exe";
|
||||
private static Process process;
|
||||
private static final Logging log = getLogging(SimulatorHelper.class);
|
||||
|
||||
public static boolean isBinaryHere() {
|
||||
return new File(BINARY).exists();
|
||||
|
@ -29,14 +33,13 @@ public class SimulatorHelper {
|
|||
private static void startSimulator() {
|
||||
LinkManager.isSimulationMode = true;
|
||||
|
||||
FileLog.MAIN.logLine("Executing simulator " + BINARY);
|
||||
log.info("Executing simulator " + BINARY);
|
||||
THREAD_FACTORY.newThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FileLog.SIMULATOR_CONSOLE.start();
|
||||
process = Runtime.getRuntime().exec(BINARY);
|
||||
FileLog.MAIN.logLine("Executing simulator " + BINARY + "=" + process);
|
||||
log.info("Executing simulator " + BINARY + "=" + process);
|
||||
SimulatorExecHelper.dumpProcessOutput(process, new CountDownLatch(1));
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
@ -57,7 +60,7 @@ public class SimulatorHelper {
|
|||
}
|
||||
if (!isPortOpened)
|
||||
throw new IllegalStateException("Port not opened?");
|
||||
FileLog.MAIN.logLine("Port " + TcpConnector.DEFAULT_PORT + " is alive");
|
||||
log.info("Port " + TcpConnector.DEFAULT_PORT + " is alive");
|
||||
|
||||
new ConsoleUI("" + TcpConnector.DEFAULT_PORT);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.maintenance;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.io.UpdateOperationCallbacks;
|
||||
|
||||
|
@ -9,6 +10,8 @@ import java.awt.event.ActionEvent;
|
|||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
/**
|
||||
* This code automates drivers unpacking and installation
|
||||
* new, DFU Virtual Comport and ST-Link drivers are installed
|
||||
|
@ -16,6 +19,7 @@ import java.io.FileNotFoundException;
|
|||
* See https://github.com/rusefi/rusefi/tree/master/misc/install_st
|
||||
*/
|
||||
public class DriverInstall {
|
||||
private static final Logging log = getLogging(DriverInstall.class);
|
||||
private static final String FOLDER = "../drivers";
|
||||
private static final String SELF_UNCOMPRESSING_ARCHIVE = "silent_st_drivers2.exe";
|
||||
private static final String YES = " -y";
|
||||
|
@ -44,11 +48,11 @@ public class DriverInstall {
|
|||
}
|
||||
|
||||
private static void installDrivers(UpdateOperationCallbacks wnd) {
|
||||
FileLog.MAIN.logLine("IsWindows=" + FileLog.isWindows());
|
||||
log.info("IsWindows=" + FileLog.isWindows());
|
||||
if (!new File(FOLDER).exists()) {
|
||||
String message = FOLDER + " not found";
|
||||
wnd.appendLine(message);
|
||||
FileLog.MAIN.logLine(message);
|
||||
log.info(message);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class VersionChecker {
|
|||
try {
|
||||
instance.readAndProcess();
|
||||
} catch (IOException e) {
|
||||
FileLog.MAIN.logLine("Failed to read from " + VERSIONS_URL + e);
|
||||
log.error("Failed to read from " + VERSIONS_URL + e);
|
||||
}
|
||||
}
|
||||
}, "version checker");
|
||||
|
@ -131,7 +131,7 @@ public class VersionChecker {
|
|||
try {
|
||||
version = Integer.parseInt(tokens[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
FileLog.MAIN.logLine("Error processing version [" + firmwareString + "]");
|
||||
log.error("Error processing version [" + firmwareString + "]");
|
||||
return;
|
||||
}
|
||||
if (version == previousReportedVersion) {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.rusefi.sensor_logs;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.NamedThreadFactory;
|
||||
import com.rusefi.Timeouts;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.maintenance.VersionChecker;
|
||||
import com.rusefi.tools.online.Online;
|
||||
import com.rusefi.tools.online.UploadResult;
|
||||
import com.rusefi.ui.AuthTokenPanel;
|
||||
|
@ -17,7 +19,10 @@ import java.util.concurrent.Executor;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
public class BinarySensorLogRestarter implements SensorLog {
|
||||
private static final Logging log = getLogging(BinarySensorLogRestarter.class);
|
||||
private final static Executor UPLOAD_EXECUTOR = Executors.newSingleThreadExecutor(new NamedThreadFactory("BinarySensorLogRestarter"));
|
||||
|
||||
private BinarySensorLog logger;
|
||||
|
@ -64,7 +69,7 @@ public class BinarySensorLogRestarter implements SensorLog {
|
|||
}
|
||||
|
||||
private void scheduleUpload(String fileName) {
|
||||
FileLog.MAIN.logLine("Will upload " + fileName);
|
||||
log.error("Will upload " + fileName);
|
||||
UPLOAD_EXECUTOR.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -150,12 +150,6 @@ public class GaugesPanel {
|
|||
@NotNull
|
||||
private JPopupMenu createMenu(final Node config) {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
final JCheckBoxMenuItem saveDetailedLogs = new JCheckBoxMenuItem("Save detailed logs");
|
||||
saveDetailedLogs.addActionListener(e -> {
|
||||
FileLog.suspendLogging = !saveDetailedLogs.isSelected();
|
||||
getConfig().getRoot().setBoolProperty(DISABLE_LOGS, FileLog.suspendLogging);
|
||||
});
|
||||
saveDetailedLogs.setSelected(!FileLog.suspendLogging);
|
||||
|
||||
final JCheckBoxMenuItem showRpmItem = new JCheckBoxMenuItem("Show RPM");
|
||||
final JCheckBoxMenuItem showCommandsItem = new JCheckBoxMenuItem("Show Commands");
|
||||
|
@ -176,7 +170,6 @@ public class GaugesPanel {
|
|||
showCommandsItem.setSelected(showMessagesPanel);
|
||||
menu.add(showCommandsItem);
|
||||
menu.add(new JPopupMenu.Separator());
|
||||
menu.add(saveDetailedLogs);
|
||||
menu.add(new JPopupMenu("Reset Config")); // todo looks like not working
|
||||
return menu;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.rusefi.ui;
|
|||
|
||||
import com.rusefi.ConsoleUI;
|
||||
import com.rusefi.core.MessagesCentral;
|
||||
import com.rusefi.io.CommandQueue;
|
||||
import com.rusefi.ui.logview.LogViewer;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -15,7 +14,7 @@ import java.awt.event.ActionListener;
|
|||
|
||||
/**
|
||||
* This tab is about uploading log files from ECU.
|
||||
*
|
||||
*
|
||||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
* 6/20/2015.
|
||||
* @see LogViewer
|
||||
|
|
|
@ -51,7 +51,6 @@ public class MainFrame {
|
|||
* here we would close the log file
|
||||
*/
|
||||
log.info("onWindowClosed");
|
||||
FileLog.MAIN.close();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.rusefi.ui.logview;
|
||||
|
||||
import com.devexperts.logging.FileLogger;
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.ConsoleUI;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.core.EngineState;
|
||||
import com.rusefi.file.FileUtils;
|
||||
import com.rusefi.sensor_logs.BinarySensorLogRestarter;
|
||||
import com.rusefi.ui.ChartRepository;
|
||||
import com.rusefi.ui.LogDownloader;
|
||||
import com.rusefi.ui.UIContext;
|
||||
|
@ -22,7 +24,10 @@ import java.io.File;
|
|||
import java.io.FileFilter;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
/**
|
||||
* TODO: what is LogViewer? is this all dead?
|
||||
* This tab is the entry point of rusEfi own log browser
|
||||
* <p/>
|
||||
* <p/>
|
||||
|
@ -37,6 +42,7 @@ public class LogViewer extends JPanel {
|
|||
return pathname.getName().contains("MAIN_rfi_report");
|
||||
}
|
||||
};
|
||||
private static final Logging log = getLogging(LogViewer.class);
|
||||
public static final String DEFAULT_LOG_LOCATION = FileLogger.DIR;
|
||||
private final JLabel folderLabel = new JLabel();
|
||||
private final JLabel fileLabel = new JLabel();
|
||||
|
@ -128,14 +134,6 @@ public class LogViewer extends JPanel {
|
|||
|
||||
while (files.length > index && uiContext.getLinkManager().isLogViewer()) {
|
||||
File file = files[index];
|
||||
if (file.getName().endsWith(FileLog.currentLogName)) {
|
||||
/**
|
||||
* we do not want to view the log file we've just started to produce.
|
||||
* We are here if the logs are newer then our current time - remember about fime zone differences
|
||||
*/
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
openFile(file);
|
||||
break;
|
||||
}
|
||||
|
@ -185,7 +183,7 @@ public class LogViewer extends JPanel {
|
|||
engineState.registerStringValueAction(Fields.PROTOCOL_ENGINE_SNIFFER, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
FileLog.MAIN.logLine("Got wave_chart: " + value);
|
||||
log.info("Got wave_chart: " + value);
|
||||
|
||||
ChartRepository.getInstance().addChart(value);
|
||||
}
|
||||
|
|
|
@ -135,7 +135,6 @@ public class AnyCommand {
|
|||
return rawCommand;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
FileLog.MAIN.log(e);
|
||||
return rawCommand;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue