Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2026 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.moduletestingenvironment.logging;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.boolex.EvaluationException;
import ch.qos.logback.core.boolex.EventEvaluator;
import ch.qos.logback.core.spi.ContextAwareBase;
import ch.qos.logback.core.spi.LifeCycle;

import java.util.regex.Pattern;

/**
* Replaces the Janino-based {@code reflectionsEmpty.matches(message)} expression previously used
* by default-logback.xml's EvaluatorFilter to suppress Reflections' "given scan urls are empty"
* warnings - JaninoEventEvaluator was removed in Logback 1.5.13.
*/
public class ReflectionsEmptyEvaluator extends ContextAwareBase implements EventEvaluator<ILoggingEvent>, LifeCycle {

private static final Pattern REFLECTIONS_EMPTY = Pattern.compile("given scan urls are empty");

private String name;
private boolean started;

@Override
public boolean evaluate(ILoggingEvent event) throws EvaluationException {
// Raw message, not formatted: formatting would also deny events whose arguments
// happen to contain the phrase.
String message = event.getMessage();
return message != null && REFLECTIONS_EMPTY.matcher(message).find();
}
Comment on lines +18 to +31

@Override
public String getName() {
return name;
}

@Override
public void setName(String name) {
this.name = name;
}

@Override
public void start() {
started = true;
}

@Override
public void stop() {
started = false;
}

@Override
public boolean isStarted() {
return started;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
</encoder>

<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<matcher>
<Name>reflectionsEmpty</Name>
<!-- filter out odd numbered statements -->
<regex>given scan urls are empty</regex>
</matcher>

<expression>reflectionsEmpty.matches(message)</expression>
</evaluator>
<evaluator class="org.terasology.moduletestingenvironment.logging.ReflectionsEmptyEvaluator" />
<OnMismatch>NEUTRAL</OnMismatch>
<OnMatch>DENY</OnMatch>
</filter>
Expand Down
Loading