Skip to content

Commit

Permalink
Fix #441
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotori316 committed Jun 17, 2024
1 parent ad29292 commit b9e63ca
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/main/scala/com/yogpc/qp/machines/TraceQuarryWork.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ private static class DummyLoader extends SecureClassLoader {
CONTEXT = Configurator.initialize("quarryplus-config", new DummyLoader(),
URI.create(Objects.requireNonNull(TraceQuarryWork.class.getResource("/quarry-log4j2.xml")).toString())
);
// temporal variable to set level, as org.apache.logging.log4j.Logger doesn't provide setters.
var l = CONTEXT.getLogger("TQW");
LOGGER = l;
WARNING_MARKER = MarkerManager.getMarker("QUARRY_WARNING");
if (!enabled) {
l.setLevel(Level.WARN);
Logger t;
if (CONTEXT != null) {
// temporal variable to set level, as org.apache.logging.log4j.Logger doesn't provide setters.
var l = CONTEXT.getLogger("TQW");
if (!enabled) {
l.setLevel(Level.WARN);
}
t = l;
} else {
// I don't know what is happening, but I should care this case
t = QuarryPlus.LOGGER;
}
LOGGER = t;
WARNING_MARKER = MarkerManager.getMarker("QUARRY_WARNING");
}

private static final Marker MARKER_START_WORK = MarkerManager.getMarker("startWork");
Expand Down

0 comments on commit b9e63ca

Please sign in to comment.