*/
public abstract class LogHelper {
- /**
- * Level from which upward a TraceException is added to the log lines.
- */
- private static final LogLevel TRACING_LOG_LEVEL =
- LogLevel.fromString(System.getProperty("openrocket.log.tracelevel"), LogLevel.INFO);
- private static final DelegatorLogger delegator = new DelegatorLogger();
-
-
-
- /**
- * Get the logger to be used in logging.
- *
- * @return the logger to be used in all logging.
- */
- public static LogHelper getInstance() {
- return delegator;
- }
-
-
-
/**
* Log a LogLine object. This method needs to be able to cope with multiple threads
* accessing it concurrently (for example by being synchronized).
@@ -52,466 +31,4 @@ public abstract class LogHelper {
*/
public abstract void log(LogLine line);
-
- /**
- * Log using VBOSE level.
- *
- * @param message the logged message (may be null).
- */
- public void verbose(String message) {
- try {
- log(createLogLine(0, LogLevel.VBOSE, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using VBOSE level.
- *
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void verbose(String message, Throwable cause) {
- try {
- log(createLogLine(0, LogLevel.VBOSE, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using VBOSE level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- */
- public void verbose(int levels, String message) {
- try {
- log(createLogLine(levels, LogLevel.VBOSE, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using VBOSE level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void verbose(int levels, String message, Throwable cause) {
- try {
- log(createLogLine(levels, LogLevel.VBOSE, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Log using DEBUG level.
- *
- * @param message the logged message (may be null).
- */
- public void debug(String message) {
- try {
- log(createLogLine(0, LogLevel.DEBUG, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using DEBUG level.
- *
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void debug(String message, Throwable cause) {
- try {
- log(createLogLine(0, LogLevel.DEBUG, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using DEBUG level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- */
- public void debug(int levels, String message) {
- try {
- log(createLogLine(levels, LogLevel.DEBUG, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using DEBUG level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void debug(int levels, String message, Throwable cause) {
- try {
- log(createLogLine(levels, LogLevel.DEBUG, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Log using INFO level.
- *
- * @param message the logged message (may be null).
- */
- public void info(String message) {
- try {
- log(createLogLine(0, LogLevel.INFO, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using INFO level.
- *
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void info(String message, Throwable cause) {
- try {
- log(createLogLine(0, LogLevel.INFO, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using INFO level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- */
- public void info(int levels, String message) {
- try {
- log(createLogLine(levels, LogLevel.INFO, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using INFO level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void info(int levels, String message, Throwable cause) {
- try {
- log(createLogLine(levels, LogLevel.INFO, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Log using USER level.
- *
- * @param message the logged message (may be null).
- */
- public void user(String message) {
- try {
- log(createLogLine(0, LogLevel.USER, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using USER level.
- *
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void user(String message, Throwable cause) {
- try {
- log(createLogLine(0, LogLevel.USER, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using USER level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- */
- public void user(int levels, String message) {
- try {
- log(createLogLine(levels, LogLevel.USER, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using USER level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void user(int levels, String message, Throwable cause) {
- try {
- log(createLogLine(levels, LogLevel.USER, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Log using WARN level.
- *
- * @param message the logged message (may be null).
- */
- public void warn(String message) {
- try {
- log(createLogLine(0, LogLevel.WARN, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using WARN level.
- *
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void warn(String message, Throwable cause) {
- try {
- log(createLogLine(0, LogLevel.WARN, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using WARN level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- */
- public void warn(int levels, String message) {
- try {
- log(createLogLine(levels, LogLevel.WARN, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using WARN level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void warn(int levels, String message, Throwable cause) {
- try {
- log(createLogLine(levels, LogLevel.WARN, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Log using ERROR level.
- *
- * @param message the logged message (may be null).
- */
- public void error(String message) {
- try {
- log(createLogLine(0, LogLevel.ERROR, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using ERROR level.
- *
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void error(String message, Throwable cause) {
- try {
- log(createLogLine(0, LogLevel.ERROR, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using ERROR level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- */
- public void error(int levels, String message) {
- try {
- log(createLogLine(levels, LogLevel.ERROR, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using ERROR level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void error(int levels, String message, Throwable cause) {
- try {
- log(createLogLine(levels, LogLevel.ERROR, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
-
- /**
- * Log using the provided log level.
- *
- * @param level the logging level.
- * @param message the logged message (may be null).
- */
- public void log(LogLevel level, String message) {
- try {
- log(createLogLine(0, level, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using the provided log level.
- *
- * @param level the logging level.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void log(LogLevel level, String message, Throwable cause) {
- try {
- log(createLogLine(0, level, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using the provided log level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param level the logging level.
- * @param message the logged message (may be null).
- */
- public void log(int levels, LogLevel level, String message) {
- try {
- log(createLogLine(levels, level, message, null));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Log using the provided log level.
- *
- * @param levels number of additional levels of stack trace to include.
- * @param level the logging level.
- * @param message the logged message (may be null).
- * @param cause the causing exception (may be null).
- */
- public void log(int levels, LogLevel level, String message, Throwable cause) {
- try {
- log(createLogLine(levels, level, message, cause));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
-
- /**
- * Instantiates, logs and throws a BugException. The message is logged at
- * ERROR level.
- *
- * This method never returns normally.
- *
- * @param message the message for the log and exception.
- * @throws BugException always.
- */
- public void throwBugException(String message) throws BugException {
- BugException e = new BugException(message);
- log(createLogLine(0, LogLevel.ERROR, message, e));
- throw e;
- }
-
- /**
- * Instantiates, logs and throws a BugException. The message is logged at
- * ERROR level with the specified cause.
- *
- * This method never returns normally.
- *
- * @param message the message for the log and exception.
- * @param cause the causing exception (may be null).
- * @throws BugException always.
- */
- public void throwBugException(String message, Throwable cause) throws BugException {
- BugException e = new BugException(message, cause);
- log(createLogLine(0, LogLevel.ERROR, message, cause));
- throw e;
- }
-
-
-
-
- /**
- * Create a LogLine object from the provided information. This method must be
- * called directly from the called method in order for the trace position
- * to be correct!
- *
- * @param additionalLevels how many additional stack trace levels to include on the line.
- * @param level the log level.
- * @param message the log message (null ok).
- * @param cause the log exception (null ok).
- *
- * @return a LogLine populated with all necessary fields.
- */
- private LogLine createLogLine(int additionalLevels, LogLevel level, String message,
- Throwable cause) {
- TraceException trace;
- if (level.atLeast(TRACING_LOG_LEVEL)) {
- trace = new TraceException(2, 2 + additionalLevels);
- } else {
- trace = null;
- }
- return new LogLine(level, trace, message, cause);
- }
}
diff --git a/core/src/net/sf/openrocket/logging/LogLine.java b/core/src/net/sf/openrocket/logging/LogLine.java
index c2dc4fa6c..c4c0d4cb1 100644
--- a/core/src/net/sf/openrocket/logging/LogLine.java
+++ b/core/src/net/sf/openrocket/logging/LogLine.java
@@ -67,7 +67,7 @@ public class LogLine implements Comparable {
}
-
+
/**
* @return the level
*/
@@ -92,14 +92,14 @@ public class LogLine implements Comparable {
}
- /**
- * @return the trace
- */
- public TraceException getTrace() {
- return trace;
+ public String getLocation() {
+ if (trace != null) {
+ return trace.getLocation();
+ } else {
+ return "(-)";
+ }
}
-
/**
* @return the message
*/
@@ -116,8 +116,8 @@ public class LogLine implements Comparable {
}
-
-
+
+
/**
* Return a formatted string of the log line. The line contains the log
* line count, the time stamp, the log level, the trace position, the log
@@ -129,7 +129,7 @@ public class LogLine implements Comparable {
String str;
str = String.format("%4d %10.3f %-" + LogLevel.LENGTH + "s %s %s",
count, timestamp / 1000.0, (level != null) ? level.toString() : "NULL",
- (trace != null) ? trace.getMessage() : "(-)",
+ getLocation(),
message);
if (cause != null) {
StackTraceWriter stw = new StackTraceWriter();
diff --git a/core/src/net/sf/openrocket/logging/LogbackBufferLoggerAdaptor.java b/core/src/net/sf/openrocket/logging/LogbackBufferLoggerAdaptor.java
new file mode 100644
index 000000000..8b3bda931
--- /dev/null
+++ b/core/src/net/sf/openrocket/logging/LogbackBufferLoggerAdaptor.java
@@ -0,0 +1,56 @@
+package net.sf.openrocket.logging;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.ThrowableProxy;
+import ch.qos.logback.core.AppenderBase;
+
+public class LogbackBufferLoggerAdaptor extends AppenderBase {
+
+ private final LogHelper logHelper;
+
+ public LogbackBufferLoggerAdaptor() {
+ logHelper = LoggingSystemSetup.getInstance();
+ }
+
+ public LogbackBufferLoggerAdaptor(LogHelper logHelper) {
+ this.logHelper = logHelper;
+ }
+
+ @Override
+ protected void append(ILoggingEvent e) {
+ e.getCallerData();
+ LogLine ll = toLogLine(e);
+
+ logHelper.log(ll);
+ }
+
+ private LogLevel toORLevel(Level l) {
+ switch (l.toInt()) {
+ case Level.TRACE_INT:
+ return LogLevel.VBOSE;
+ case Level.DEBUG_INT:
+ return LogLevel.DEBUG;
+ case Level.INFO_INT:
+ return LogLevel.INFO;
+ case Level.WARN_INT:
+ return LogLevel.WARN;
+ case Level.ERROR_INT:
+ return LogLevel.ERROR;
+ default:
+ return LogLevel.ERROR;
+ }
+ }
+
+ private LogLine toLogLine(ILoggingEvent e) {
+ LogLevel l = toORLevel(e.getLevel());
+ if (SLF4JLogHelper.USER_MARKER.equals(e.getMarker()))
+ l = LogLevel.USER;
+ Throwable t = null;
+ if (e.getThrowableProxy() != null) {
+ t = ((ThrowableProxy) e.getThrowableProxy()).getThrowable();
+ }
+ return new LogLine(l, new TraceException(), e.getMessage(), t);
+ }
+
+}
diff --git a/core/src/net/sf/openrocket/logging/LoggingSystemSetup.java b/core/src/net/sf/openrocket/logging/LoggingSystemSetup.java
new file mode 100644
index 000000000..b38123881
--- /dev/null
+++ b/core/src/net/sf/openrocket/logging/LoggingSystemSetup.java
@@ -0,0 +1,30 @@
+package net.sf.openrocket.logging;
+
+
+public class LoggingSystemSetup {
+
+ private static final DelegatorLogger delegator = new DelegatorLogger();
+
+ private static final int LOG_BUFFER_LENGTH = 50;
+
+ private static final LogLevelBufferLogger llbl = new LogLevelBufferLogger(LOG_BUFFER_LENGTH);
+
+ static {
+ delegator.addLogger(llbl);
+
+ }
+
+ /**
+ * Get the logger to be used in logging.
+ *
+ * @return the logger to be used in all logging.
+ */
+ public static DelegatorLogger getInstance() {
+ return delegator;
+ }
+
+ public static LogLevelBufferLogger getBufferLogger() {
+ return llbl;
+ }
+
+}
diff --git a/core/src/net/sf/openrocket/logging/SLF4JLogHelper.java b/core/src/net/sf/openrocket/logging/SLF4JLogHelper.java
new file mode 100644
index 000000000..e1625e2fd
--- /dev/null
+++ b/core/src/net/sf/openrocket/logging/SLF4JLogHelper.java
@@ -0,0 +1,38 @@
+package net.sf.openrocket.logging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+public class SLF4JLogHelper extends DelegatorLogger {
+
+ private static final Logger log = LoggerFactory.getLogger(SLF4JLogHelper.class);
+ static final Marker USER_MARKER = MarkerFactory.getMarker("User");
+
+ @Override
+ public void log(LogLine line) {
+ super.log(line);
+ switch (line.getLevel()) {
+ case VBOSE:
+ log.trace(line.getMessage(), line.getCause());
+ break;
+ case DEBUG:
+ log.debug(line.getMessage(), line.getCause());
+ break;
+ case INFO:
+ log.info(line.getMessage(), line.getCause());
+ break;
+ case USER:
+ log.info(USER_MARKER, line.getMessage(), line.getCause());
+ break;
+ case WARN:
+ log.warn(line.getMessage(), line.getCause());
+ break;
+ case ERROR:
+ log.error(line.getMessage(), line.getCause());
+ break;
+ }
+ }
+
+}
diff --git a/core/src/net/sf/openrocket/logging/TraceException.java b/core/src/net/sf/openrocket/logging/TraceException.java
index f3fc1714a..36415234a 100644
--- a/core/src/net/sf/openrocket/logging/TraceException.java
+++ b/core/src/net/sf/openrocket/logging/TraceException.java
@@ -2,97 +2,33 @@ package net.sf.openrocket.logging;
+
/**
* An exception that is used to store a stack trace. On modern computers
* instantiation of an exception takes on the order of one microsecond, while
* examining the trace typically takes several times longer. Therefore the
* exception should be stored and the stack trace examined only when necessary.
*
- * The {@link #getMessage()} method returns a description of the position
- * where this exception has been instantiated. The position is provided
- * as many levels upwards from the instantiation position as provided to the
- * constructor.
+ * The {@link #getLocation()} method returns a description of the position
+ * where this exception has been instantiated.
*
* @author Sampo Niskanen
*/
-public class TraceException extends Exception {
+class TraceException {
private static final String STANDARD_PACKAGE_PREFIX = "net.sf.openrocket.";
+ private static final String EXCLUDED_PACKAGE_PREFIX = "net.sf.openrocket.logging";
- private final int minLevel;
- private final int maxLevel;
- private volatile String message = null;
+ private final Throwable t;
+ private volatile String location;
-
- /**
- * Instantiate exception that provides the line of instantiation as a message.
- */
- public TraceException() {
- this(0, 0);
+ TraceException() {
+ t = new Throwable();
}
- /**
- * Instantiate exception that provides the provided number of levels upward
- * from the instantiation location as a message. The level provided
- * is how many levels upward should be examined to find the stack trace
- * position for the exception message.
- *
- * @param level how many levels upward to examine the stack trace to find
- * the correct message.
- */
- public TraceException(int level) {
- this(level, level);
- }
-
-
- /**
- * Instantiate exception that provides a range of levels upward from the
- * instantiation location as a message. This is useful to identify the
- * next level of callers upward.
- *
- * @param minLevel the first level which to include.
- * @param maxLevel the last level which to include.
- */
- public TraceException(int minLevel, int maxLevel) {
- if (minLevel > maxLevel || minLevel < 0) {
- throw new IllegalArgumentException("minLevel=" + minLevel + " maxLevel=" + maxLevel);
- }
- this.minLevel = minLevel;
- this.maxLevel = maxLevel;
- }
-
-
- /**
- * Construct an exception with the specified message.
- *
- * @param message the message for the exception.
- */
- public TraceException(String message) {
- this(0, 0);
- this.message = message;
- }
-
-
- /**
- * Construct an exception with the specified message and cause.
- *
- * @param message the message for the exception.
- * @param cause the cause for this exception.
- */
- public TraceException(String message, Throwable cause) {
- this(0, 0);
- this.message = message;
- this.initCause(cause);
- }
-
-
- /**
- * Get the description of the code position as provided in the constructor.
- */
- @Override
- public String getMessage() {
- if (message == null) {
- StackTraceElement[] elements = this.getStackTrace();
+ public String getLocation() {
+ if (location == null) {
+ StackTraceElement[] elements = t.getStackTrace();
StringBuilder sb = new StringBuilder();
sb.append('(');
@@ -101,30 +37,35 @@ public class TraceException extends Exception {
sb.append("no stack trace");
} else {
- int levelCount = 0;
- int position = minLevel;
- while (levelCount <= (maxLevel - minLevel) && position < elements.length) {
+ int found = -1;
+ int index = 0;
+ while (found < 0 && index < elements.length) {
// Ignore synthetic "access$0" methods generated by the JRE
- if (elements[position].getMethodName().contains("$")) {
- position++;
+ if (elements[index].getMethodName().contains("$")) {
+ index++;
continue;
}
- if (levelCount > 0) {
- sb.append(' ');
+ String className = elements[index].getClassName();
+ if (!className.startsWith(EXCLUDED_PACKAGE_PREFIX) && className.startsWith(STANDARD_PACKAGE_PREFIX)) {
+ sb.append(toString(elements[index]));
+ found = 1;
+ break;
}
- sb.append(toString(elements[position]));
- levelCount++;
- position++;
+
+ index++;
+
+ }
+ if (found < 0) {
+ sb.append(toString(elements[0]));
}
-
}
sb.append(')');
- message = sb.toString();
+ location = sb.toString();
}
- return message;
+ return location;
}
diff --git a/core/src/net/sf/openrocket/startup/Application.java b/core/src/net/sf/openrocket/startup/Application.java
index 16bf4ed4a..b08d106e1 100644
--- a/core/src/net/sf/openrocket/startup/Application.java
+++ b/core/src/net/sf/openrocket/startup/Application.java
@@ -8,10 +8,7 @@ import net.sf.openrocket.l10n.ClassBasedTranslator;
import net.sf.openrocket.l10n.DebugTranslator;
import net.sf.openrocket.l10n.ExceptionSuppressingTranslator;
import net.sf.openrocket.l10n.Translator;
-import net.sf.openrocket.logging.LogHelper;
import net.sf.openrocket.logging.LogLevel;
-import net.sf.openrocket.logging.LogLevelBufferLogger;
-import net.sf.openrocket.logging.PrintStreamLogger;
import com.google.inject.Injector;
@@ -22,9 +19,6 @@ import com.google.inject.Injector;
*/
public final class Application {
- private static LogHelper logger;
- private static LogLevelBufferLogger logBuffer;
-
private static Translator baseTranslator = new DebugTranslator(null);
private static ComponentPresetDao componentPresetDao;
@@ -52,44 +46,10 @@ public final class Application {
return false;
}
- /**
- * Retrieve the logger to be used in logging. By default this returns
- * a logger that outputs to stdout/stderr even if not separately initialized,
- * useful for development and debugging.
- */
- public static LogHelper getLogger() {
- return logger;
- }
-
- /**
- * Set the logger to be used in logging. Note that calling this will only have effect
- * on not-yet loaded classes, as the instance is stored in a static variable.
- */
- public static void setLogger(LogHelper logger) {
- Application.logger = logger;
- }
-
public static WatchService getWatchService() {
return Application.injector.getInstance(WatchService.class);
}
- /**
- * Return the log buffer.
- *
- * @return the logBuffer or null if not initialized
- */
- public static LogLevelBufferLogger getLogBuffer() {
- return logBuffer;
- }
-
- /**
- * Set the log buffer logger. The logger must be separately configured
- * to receive the logging.
- */
- public static void setLogBuffer(LogLevelBufferLogger logBuffer) {
- Application.logBuffer = logBuffer;
- }
-
/**
* Set the logging to output the specified log level and upwards to standard output.
@@ -97,13 +57,15 @@ public final class Application {
* @param level the minimum logging level to output.
*/
public static void setLogOutputLevel(LogLevel level) {
+ // FIXME
+ /*
logger = new PrintStreamLogger();
for (LogLevel l : LogLevel.values()) {
if (l.atLeast(level)) {
((PrintStreamLogger) logger).setOutput(l, System.out);
}
}
-
+ */
}
diff --git a/core/src/net/sf/openrocket/startup/ApplicationModule.java b/core/src/net/sf/openrocket/startup/ApplicationModule.java
index 6e8cb948b..0738d15e9 100644
--- a/core/src/net/sf/openrocket/startup/ApplicationModule.java
+++ b/core/src/net/sf/openrocket/startup/ApplicationModule.java
@@ -5,7 +5,6 @@ import net.sf.openrocket.formatting.RocketDescriptorImpl;
import net.sf.openrocket.gui.watcher.WatchService;
import net.sf.openrocket.gui.watcher.WatchServiceImpl;
import net.sf.openrocket.l10n.Translator;
-import net.sf.openrocket.logging.LogHelper;
import com.google.inject.AbstractModule;
@@ -13,7 +12,6 @@ public class ApplicationModule extends AbstractModule {
@Override
protected void configure() {
- bind(LogHelper.class).toInstance(Application.getLogger());
bind(Preferences.class).toInstance(Application.getPreferences());
bind(Translator.class).toInstance(Application.getTranslator());
bind(WatchService.class).to(WatchServiceImpl.class);
diff --git a/core/src/net/sf/openrocket/startup/ApplicationStartup.java b/core/src/net/sf/openrocket/startup/ApplicationStartup.java
index bafd76d87..c469513d4 100644
--- a/core/src/net/sf/openrocket/startup/ApplicationStartup.java
+++ b/core/src/net/sf/openrocket/startup/ApplicationStartup.java
@@ -23,9 +23,11 @@ import net.sf.openrocket.gui.main.SwingExceptionHandler;
import net.sf.openrocket.gui.util.BlockingMotorDatabaseProvider;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.SwingPreferences;
-import net.sf.openrocket.logging.LogHelper;
import net.sf.openrocket.util.BuildProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.inject.Inject;
import com.google.inject.Injector;
@@ -41,8 +43,8 @@ import com.google.inject.Injector;
*/
public class ApplicationStartup {
- @Inject
- private LogHelper log;
+ private final static Logger log = LoggerFactory.getLogger(ApplicationStartup.class);
+
@Inject
private Injector injector;
diff --git a/core/src/net/sf/openrocket/startup/GuiceStartup.java b/core/src/net/sf/openrocket/startup/GuiceStartup.java
index 865955b4c..1a7e637b4 100644
--- a/core/src/net/sf/openrocket/startup/GuiceStartup.java
+++ b/core/src/net/sf/openrocket/startup/GuiceStartup.java
@@ -1,7 +1,5 @@
package net.sf.openrocket.startup;
-import java.io.IOException;
-import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Locale;
import java.util.prefs.Preferences;
@@ -11,13 +9,13 @@ import net.sf.openrocket.l10n.DebugTranslator;
import net.sf.openrocket.l10n.L10N;
import net.sf.openrocket.l10n.ResourceBundleTranslator;
import net.sf.openrocket.l10n.Translator;
-import net.sf.openrocket.logging.DelegatorLogger;
-import net.sf.openrocket.logging.LogHelper;
import net.sf.openrocket.logging.LogLevel;
-import net.sf.openrocket.logging.LogLevelBufferLogger;
import net.sf.openrocket.logging.PrintStreamLogger;
import net.sf.openrocket.plugin.PluginModule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
@@ -40,12 +38,7 @@ import com.google.inject.Module;
*/
public class GuiceStartup {
- static LogHelper log;
-
- private static final String LOG_STDERR_PROPERTY = "openrocket.log.stderr";
- private static final String LOG_STDOUT_PROPERTY = "openrocket.log.stdout";
-
- private static final int LOG_BUFFER_LENGTH = 50;
+ private final static Logger log = LoggerFactory.getLogger(GuiceStartup.class);
/**
* OpenRocket startup main method.
@@ -76,8 +69,6 @@ public class GuiceStartup {
*/
private static void checkDebugStatus() {
if (System.getProperty("openrocket.debug") != null) {
- setPropertyIfNotSet("openrocket.log.stdout", "VBOSE");
- setPropertyIfNotSet("openrocket.log.tracelevel", "VBOSE");
setPropertyIfNotSet("openrocket.debug.menu", "true");
setPropertyIfNotSet("openrocket.debug.mutexlocation", "true");
setPropertyIfNotSet("openrocket.debug.motordigest", "true");
@@ -97,7 +88,7 @@ public class GuiceStartup {
* Initializes the loggins system.
*/
public static void initializeLogging() {
- DelegatorLogger delegator = new DelegatorLogger();
+ /*DelegatorLogger delegator = new DelegatorLogger();
// Log buffer
LogLevelBufferLogger buffer = new LogLevelBufferLogger(LOG_BUFFER_LENGTH);
@@ -135,7 +126,6 @@ public class GuiceStartup {
log.info(str);
-
//Replace System.err with a PrintStream that logs lines to DEBUG, or VBOSE if they are indented.
//If debug info is not being output to the console then the data is both logged and written to
//stderr.
@@ -167,6 +157,7 @@ public class GuiceStartup {
}
}
}));
+ */
}
private static boolean setLogOutput(PrintStreamLogger logger, PrintStream stream, String level, LogLevel defaultLevel) {
diff --git a/core/src/net/sf/openrocket/startup/MotorDatabaseLoader.java b/core/src/net/sf/openrocket/startup/MotorDatabaseLoader.java
index 6999c1019..86b48c3c3 100644
--- a/core/src/net/sf/openrocket/startup/MotorDatabaseLoader.java
+++ b/core/src/net/sf/openrocket/startup/MotorDatabaseLoader.java
@@ -15,13 +15,13 @@ import net.sf.openrocket.file.iterator.FileIterator;
import net.sf.openrocket.file.motor.GeneralMotorLoader;
import net.sf.openrocket.gui.util.SimpleFileFilter;
import net.sf.openrocket.gui.util.SwingPreferences;
-import net.sf.openrocket.logging.LogHelper;
import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.motor.ThrustCurveMotor;
import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Pair;
-import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An asynchronous database loader that loads the internal thrust curves
@@ -31,12 +31,12 @@ import com.google.inject.Inject;
* @author Sampo Niskanen
*/
public class MotorDatabaseLoader extends AsynchronousDatabaseLoader {
+
+ private final static Logger log = LoggerFactory.getLogger(MotorDatabaseLoader.class);
+
private static final String THRUSTCURVE_DIRECTORY = "datafiles/thrustcurves/";
private static final long STARTUP_DELAY = 0;
- @Inject
- private LogHelper log;
-
private final ThrustCurveMotorSetDatabase database = new ThrustCurveMotorSetDatabase();
private int motorCount = 0;
diff --git a/core/src/net/sf/openrocket/startup/SerializePresets.java b/core/src/net/sf/openrocket/startup/SerializePresets.java
index 03ce866fa..f2259ab24 100644
--- a/core/src/net/sf/openrocket/startup/SerializePresets.java
+++ b/core/src/net/sf/openrocket/startup/SerializePresets.java
@@ -59,7 +59,7 @@ public class SerializePresets {
List list = componentPresetDao.listAll();
- Application.getLogger().info("Total number of presets = " + list.size());
+ System.out.println("Total number of presets = " + list.size());
File outFile = new File("resources/datafiles/presets", "system.ser");
diff --git a/core/src/net/sf/openrocket/util/Invalidator.java b/core/src/net/sf/openrocket/util/Invalidator.java
index 4c2ae2459..481e9376c 100644
--- a/core/src/net/sf/openrocket/util/Invalidator.java
+++ b/core/src/net/sf/openrocket/util/Invalidator.java
@@ -1,11 +1,10 @@
package net.sf.openrocket.util;
+import net.sf.openrocket.startup.Application;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.sf.openrocket.logging.TraceException;
-import net.sf.openrocket.startup.Application;
-
/**
* A class that performs object invalidation functions.
*
@@ -17,7 +16,7 @@ public class Invalidator implements Invalidatable {
private static final Logger log = LoggerFactory.getLogger(Invalidator.class);
private final Object monitorable;
- private TraceException invalidated = null;
+ private Throwable invalidated = null;
/**
@@ -45,7 +44,7 @@ public class Invalidator implements Invalidatable {
throw new BugException(monitorable + ": This object has been invalidated", invalidated);
} else {
log.warn(monitorable + ": This object has been invalidated",
- new TraceException("Usage was attempted here", invalidated));
+ new Throwable("Usage was attempted here", invalidated));
}
return false;
}
@@ -68,7 +67,7 @@ public class Invalidator implements Invalidatable {
if (invalidated != null) {
log.warn(monitorable + ": This object has already been invalidated, ignoring", invalidated);
}
- invalidated = new TraceException("Invalidation occurred here");
+ invalidated = new Throwable("Invalidation occurred here");
}
}
diff --git a/core/src/net/sf/openrocket/util/ListenerList.java b/core/src/net/sf/openrocket/util/ListenerList.java
index e315944c5..cd726c6ed 100644
--- a/core/src/net/sf/openrocket/util/ListenerList.java
+++ b/core/src/net/sf/openrocket/util/ListenerList.java
@@ -5,8 +5,6 @@ import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.sf.openrocket.logging.TraceException;
-
/**
* A list of listeners of a specific type. This class contains various utility,
* safety and debugging methods for handling listeners.
@@ -23,19 +21,18 @@ public class ListenerList implements Invalidatable, Iterable {
private static final Logger log = LoggerFactory.getLogger(ListenerList.class);
private final ArrayList> listeners = new ArrayList>();
- private final TraceException instantiationLocation;
+ private final Throwable instantiationLocation;
- private TraceException invalidated = null;
+ private Throwable invalidated = null;
/**
* Sole contructor.
*/
public ListenerList() {
- this.instantiationLocation = new TraceException(1, 1);
+ this.instantiationLocation = new Throwable();
}
-
/**
* Adds the specified listener to this list. The listener is not added if it
* already is in the list (checked by the equality operator ==). This method throws
@@ -105,7 +102,7 @@ public class ListenerList implements Invalidatable, Iterable {
* Return the instantiation location of this listener list.
* @return the location where this listener list was instantiated.
*/
- public TraceException getInstantiationLocation() {
+ public Throwable getInstantiationLocation() {
return instantiationLocation;
}
@@ -117,7 +114,7 @@ public class ListenerList implements Invalidatable, Iterable {
*/
@Override
public void invalidate() {
- this.invalidated = new TraceException("Invalidation occurred at this point");
+ this.invalidated = new Throwable("Invalidation occurred at this point");
if (!listeners.isEmpty()) {
log.info("Invalidating " + this + " while still having listeners " + listeners);
}
@@ -136,7 +133,7 @@ public class ListenerList implements Invalidatable, Iterable {
throw new BugException(this + ": this ListenerList has been invalidated", invalidated);
} else {
log.warn(this + ": this ListenerList has been invalidated",
- new TraceException("ListenerList was attempted to be used here", invalidated));
+ new Throwable("ListenerList was attempted to be used here", invalidated));
}
}
}
@@ -178,7 +175,7 @@ public class ListenerList implements Invalidatable, Iterable {
public static class ListenerData {
private final T listener;
private final long addTimestamp;
- private final TraceException addLocation;
+ private final Throwable addLocation;
private long accessTimestamp;
/**
@@ -191,7 +188,7 @@ public class ListenerList implements Invalidatable, Iterable {
this.listener = listener;
this.addTimestamp = System.currentTimeMillis();
this.accessTimestamp = this.addTimestamp;
- this.addLocation = new TraceException("Listener " + listener + " add position");
+ this.addLocation = new Throwable("Listener " + listener + " add position");
}
@Override
@@ -227,7 +224,7 @@ public class ListenerList implements Invalidatable, Iterable {
/**
* Return the location where this listener was added to the listener list.
*/
- public TraceException getAddLocation() {
+ public Throwable getAddLocation() {
return addLocation;
}
diff --git a/core/src/net/sf/openrocket/util/Mutable.java b/core/src/net/sf/openrocket/util/Mutable.java
index c7c91359f..5fc098555 100644
--- a/core/src/net/sf/openrocket/util/Mutable.java
+++ b/core/src/net/sf/openrocket/util/Mutable.java
@@ -1,6 +1,5 @@
package net.sf.openrocket.util;
-import net.sf.openrocket.logging.TraceException;
/**
* A utility class helping an object to be made immutable after a certain point of time.
@@ -15,7 +14,7 @@ import net.sf.openrocket.logging.TraceException;
*/
public class Mutable implements Cloneable {
- private TraceException immuteTrace = null;
+ private Throwable immuteTrace = null;
/**
* Mark the object immutable. Once the object has been called the object
@@ -23,7 +22,7 @@ public class Mutable implements Cloneable {
*/
public void immute() {
if (immuteTrace == null) {
- immuteTrace = new TraceException(1, 2);
+ immuteTrace = new Throwable();
}
}
diff --git a/core/src/net/sf/openrocket/util/SafetyMutex.java b/core/src/net/sf/openrocket/util/SafetyMutex.java
index 0c77be67c..f391de1e9 100644
--- a/core/src/net/sf/openrocket/util/SafetyMutex.java
+++ b/core/src/net/sf/openrocket/util/SafetyMutex.java
@@ -2,12 +2,11 @@ package net.sf.openrocket.util;
import java.util.LinkedList;
+import net.sf.openrocket.startup.Application;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.sf.openrocket.logging.TraceException;
-import net.sf.openrocket.startup.Application;
-
/**
* A mutex that can be used for verifying thread safety. This class cannot be
* used to perform synchronization, only to detect concurrency issues. This
@@ -37,7 +36,7 @@ public abstract class SafetyMutex {
}
}
-
+
/**
* Verify that this mutex is unlocked, but don't lock it. This has the same effect
* as mutex.lock(); mutex.unlock();
and is useful for methods that return
@@ -73,7 +72,7 @@ public abstract class SafetyMutex {
public abstract boolean unlock(String location);
-
+
/**
* Bogus implementation of a safety mutex (used when safety checking is not performed).
*/
@@ -106,12 +105,12 @@ public abstract class SafetyMutex {
// lockingThread is set when this mutex is locked.
Thread lockingThread = null;
// longingLocation is set when lockingThread is, if STORE_LOCKING_LOCATION is true
- TraceException lockingLocation = null;
+ Throwable lockingLocation = null;
// Stack of places that have locked this mutex
final LinkedList locations = new LinkedList();
-
+
@Override
public synchronized void verify() {
checkState(true);
@@ -121,7 +120,7 @@ public abstract class SafetyMutex {
}
-
+
@Override
public synchronized void lock(String location) {
if (location == null) {
@@ -136,14 +135,14 @@ public abstract class SafetyMutex {
lockingThread = currentThread;
if (STORE_LOCKING_LOCATION) {
- lockingLocation = new TraceException("Location where mutex was locked '" + location + "'");
+ lockingLocation = new Throwable("Location where mutex was locked '" + location + "'");
}
locations.push(location);
}
-
-
+
+
@Override
public synchronized boolean unlock(String location) {
try {
@@ -154,7 +153,7 @@ public abstract class SafetyMutex {
}
checkState(false);
-
+
// Check that the mutex is locked
if (lockingThread == null) {
error("Mutex was not locked", false);
@@ -189,7 +188,7 @@ public abstract class SafetyMutex {
}
-
+
/**
* Check that the internal state of the mutex (lockingThread vs. locations) is correct.
*/
diff --git a/core/test/net/sf/openrocket/logging/LogLevelBufferLoggerTest.java b/core/test/net/sf/openrocket/logging/LogLevelBufferLoggerTest.java
index 4bd9b8d42..a2de165ad 100644
--- a/core/test/net/sf/openrocket/logging/LogLevelBufferLoggerTest.java
+++ b/core/test/net/sf/openrocket/logging/LogLevelBufferLoggerTest.java
@@ -5,35 +5,54 @@ import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.Test;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
public class LogLevelBufferLoggerTest {
+ // NOTE cast
+ private final static Logger logger = (Logger) LoggerFactory.getLogger(LogLevelBufferLoggerTest.class);
+
@Test
public void testLogger() {
- LogLevelBufferLogger logger = new LogLevelBufferLogger(4);
+
+ DelegatorLogger l = new DelegatorLogger();
+ LogLevelBufferLogger llbl = new LogLevelBufferLogger(4);
+
+ // assume SLF4J is bound to logback in the current environment
+ LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
+
+ // Call context.reset() to clear any previous configuration, e.g. default
+ // configuration. For multi-step configuration, omit calling context.reset().
+ context.reset();
+ LogbackBufferLoggerAdaptor a = new LogbackBufferLoggerAdaptor(llbl);
+ a.start();
+ logger.addAppender(a);
logger.debug("debug 1");
logger.debug("debug 2");
- logger.user("user 1");
+ logger.info(Markers.USER_MARKER, "user 1");
logger.info("info 1");
logger.info("info 2");
logger.warn("warn 1");
logger.debug("debug 3");
logger.debug("debug 4");
- logger.user("user 2");
+ logger.info(Markers.USER_MARKER, "user 2");
logger.info("info 3");
logger.error("error 1");
logger.debug("debug 5");
logger.warn("warn 2");
logger.debug("debug 6");
- logger.user("user 3");
+ logger.info(Markers.USER_MARKER, "user 3");
logger.info("info 4");
logger.debug("debug 7");
logger.info("info 5");
logger.debug("debug 8");
logger.info("info 6");
- List list = logger.getLogs();
+ List list = llbl.getLogs();
assertEquals(16, list.size());
assertEquals("user 1", list.get(0).getMessage());
@@ -54,5 +73,4 @@ public class LogLevelBufferLoggerTest {
assertEquals("info 6", list.get(15).getMessage());
}
-
}
diff --git a/core/test/net/sf/openrocket/logging/LoggingTest.java b/core/test/net/sf/openrocket/logging/LoggingTest.java
deleted file mode 100644
index 39e4777db..000000000
--- a/core/test/net/sf/openrocket/logging/LoggingTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.sf.openrocket.logging;
-
-import static org.junit.Assert.*;
-
-import java.util.List;
-
-import org.junit.Test;
-
-public class LoggingTest {
-
- @Test
- public void testLoggers() {
- // Ensure a sane stack trace
- actualTest();
- }
-
- private void actualTest() {
- BufferLogger log3 = new BufferLogger(3);
- BufferLogger log4 = new BufferLogger(4);
-
- DelegatorLogger delegator = new DelegatorLogger();
- delegator.addLogger(log3);
- delegator.addLogger(log4);
-
- delegator.debug("one");
- delegator.debug("two");
- delegator.info("three");
- delegator.warn(1, "four");
- delegator.error("five");
-
- List logs = log4.getLogs();
- assertEquals(4, logs.size());
- assertTrue(logs.get(0).toString(), logs.get(0).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +DEBUG \\(-\\) two"));
- assertTrue(logs.get(1).toString(), logs.get(1).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +INFO \\(LoggingTest.java:[0-9]+\\) three"));
- assertTrue(logs.get(2).toString(), logs.get(2).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +WARN \\(LoggingTest.java:[0-9]+ LoggingTest.java:[0-9]+\\) four"));
- assertTrue(logs.get(3).toString(), logs.get(3).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +ERROR \\(LoggingTest.java:[0-9]+\\) five"));
-
- logs = log3.getLogs();
- assertEquals(3, logs.size());
- assertTrue(logs.get(0).toString(), logs.get(0).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +INFO \\(LoggingTest.java:[0-9]+\\) three"));
- assertTrue(logs.get(1).toString(), logs.get(1).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +WARN \\(LoggingTest.java:[0-9]+ LoggingTest.java:[0-9]+\\) four"));
- assertTrue(logs.get(2).toString(), logs.get(2).toString().matches(
- " *[0-9]+ +[0-9]+\\.[0-9]+ +ERROR \\(LoggingTest.java:[0-9]+\\) five"));
-
- }
-
- public static void main(String[] args) {
- PrintStreamLogger logger = new PrintStreamLogger();
-
- logger.debug("a debug message");
- logger.info("an info message");
- logger.warn("a warning message");
- logger.error("an error message");
-
- logger.debug(4, "Debugging");
- }
-}
diff --git a/core/test/net/sf/openrocket/logging/TraceExceptionTest.java b/core/test/net/sf/openrocket/logging/TraceExceptionTest.java
deleted file mode 100644
index 72f3c13a3..000000000
--- a/core/test/net/sf/openrocket/logging/TraceExceptionTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package net.sf.openrocket.logging;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class TraceExceptionTest {
-
- private TraceException getViaAccess() {
-
- /*
- * The SubClass test bases on the fact that getViaAccess method is defined on a row number < 20
- * and the return statement is on a row number > 20.
- *
- * The JRE sometimes adds an additional "access$NNN" method call between the calls with the
- * row number equal to the method definition line.
- *
- *
- *
- *
- *
- *
- *
- */
-
- return new TraceException(0, 1);
- }
-
-
- @Test
- public void testBasic() {
- TraceException trace = new TraceException();
- assertMatch("\\(TraceExceptionTest.java:[2-9][0-9]\\)", trace);
- }
-
-
- @Test
- public void testOneLevelUp() {
- // @formatter:off - these need to be on the same line number
- TraceException trace = getOneLevelUp(); TraceException ref = new TraceException();
- // @formatter:on
- assertEquals(ref.getMessage(), trace.getMessage());
- }
-
- private TraceException getOneLevelUp() {
- return new TraceException(1);
- }
-
-
- @Test
- public void testTwoLevels() {
- TraceException trace = getTwoLevels();
- assertMatch("\\(TraceExceptionTest.java:[2-9][0-9] TraceExceptionTest.java:[2-9][0-9]\\)", trace);
- }
-
- private TraceException getTwoLevels() {
- return new TraceException(0, 1);
- }
-
-
- @Test
- public void testViaSubclass() {
- /*
- * This tests that TraceException.getMessage ignores the synthetic "access$0" method calls.
- */
-
- TraceException trace = new SubClass().getTrace();
- assertMatch("\\(TraceExceptionTest.java:[2-9][0-9] TraceExceptionTest.java:[2-9][0-9]\\)", trace);
- }
-
- private class SubClass {
- private TraceException getTrace() {
- return getViaAccess();
- }
- }
-
-
-
-
-
- private void assertMatch(String regex, TraceException trace) {
- boolean match = trace.getMessage().matches(regex);
- if (!match) {
- trace.printStackTrace();
- assertTrue("Was: " + trace.getMessage(), match);
- }
- }
-
-}
diff --git a/core/test/net/sf/openrocket/rocketcomponent/ConfigurationTest.java b/core/test/net/sf/openrocket/rocketcomponent/ConfigurationTest.java
index 74d8b24a5..7c1d52de9 100644
--- a/core/test/net/sf/openrocket/rocketcomponent/ConfigurationTest.java
+++ b/core/test/net/sf/openrocket/rocketcomponent/ConfigurationTest.java
@@ -7,9 +7,7 @@ import java.util.BitSet;
import java.util.EventObject;
import java.util.Iterator;
-import net.sf.openrocket.logging.LogHelper;
import net.sf.openrocket.rocketcomponent.RocketComponent.Position;
-import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.StateChangeListener;
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
@@ -175,8 +173,6 @@ public class ConfigurationTest extends BaseTestCase {
@Test
public void testGeneralMethods() {
- LogHelper log = Application.getLogger();
-
/* Setup */
Rocket r1 = makeSingleStageTestRocket();
Configuration config = r1.getDefaultConfiguration();
@@ -197,9 +193,9 @@ public class ConfigurationTest extends BaseTestCase {
double refArea = config.getReferenceArea();
// TODO validate that the values are correct
- log.debug("ConfigurationTest, length: " + String.valueOf(length));
- log.debug("ConfigurationTest, refLength: " + String.valueOf(refLength));
- log.debug("ConfigurationTest, refArea: " + String.valueOf(refArea));
+ //log.debug("ConfigurationTest, length: " + String.valueOf(length));
+ //log.debug("ConfigurationTest, refLength: " + String.valueOf(refLength));
+ //log.debug("ConfigurationTest, refArea: " + String.valueOf(refArea));
/* Cleanup */
config.release();
diff --git a/core/test/net/sf/openrocket/util/MutableTest.java b/core/test/net/sf/openrocket/util/MutableTest.java
index dfc02209f..634a42f33 100644
--- a/core/test/net/sf/openrocket/util/MutableTest.java
+++ b/core/test/net/sf/openrocket/util/MutableTest.java
@@ -1,7 +1,8 @@
package net.sf.openrocket.util;
-import static org.junit.Assert.*;
-import net.sf.openrocket.logging.TraceException;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import org.junit.Test;
@@ -24,7 +25,7 @@ public class MutableTest {
} catch (IllegalStateException e) {
// Success
t = e.getCause();
- assertTrue(t instanceof TraceException);
+ assertTrue(t instanceof Throwable);
}
m.immute();