Skip to content
Snippets Groups Projects
Commit caedb24d authored by Michael Eischer's avatar Michael Eischer
Browse files

Synchronize REFITLogger output methods

As both stdout and stderr point to the same file this can
cause garbling of log outputs between threads.
parent aa105a17
Branches
Tags
No related merge requests found
...@@ -22,11 +22,17 @@ public class REFITLogger { ...@@ -22,11 +22,17 @@ public class REFITLogger {
private static void logNormal(String type, Object component, String message) { private static void logNormal(String type, Object component, String message) {
System.out.println(REFITTime.timeMicroUTC.getAsLong() + " " + Thread.currentThread().getName() + " " + type + " " + component + ": " + message); String str = REFITTime.timeMicroUTC.getAsLong() + " " + Thread.currentThread().getName() + " " + type + " " + component + ": " + message;
synchronized (REFITLogger.class) {
System.out.println(str);
}
} }
private static void logError(String type, Object component, String message) { private static void logError(String type, Object component, String message) {
System.err.println(REFITTime.timeMicroUTC.getAsLong() + " " + Thread.currentThread().getName() + " " + type + " " + component + ": " + message); String str = REFITTime.timeMicroUTC.getAsLong() + " " + Thread.currentThread().getName() + " " + type + " " + component + ": " + message;
synchronized (REFITLogger.class) {
System.err.println(str);
}
} }
...@@ -46,6 +52,11 @@ public class REFITLogger { ...@@ -46,6 +52,11 @@ public class REFITLogger {
logError("[ERROR]", component, message); logError("[ERROR]", component, message);
} }
public static void logPlain(String message) {
synchronized (REFITLogger.class) {
System.out.println(message);
}
}
// ############ // ############
// # SPECIFIC # // # SPECIFIC #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment