Bukkit -Konsolenfilter
// in onEnable
((Logger) LogManager.getRootLogger()).addFilter(new LogFilter());
// the class
public class LogFilter implements Filter {
public Result checkMessage(String message) {
if (message.contains("filter")) {
return Filter.Result.DENY;
} else {
return Filter.Result.NEUTRAL;
}
}
@Override
public Result getOnMismatch() {
return Result.NEUTRAL;
}
@Override
public Result getOnMatch() {
return Result.NEUTRAL;
}
@Override
public Result filter(Logger logger, Level level, Marker marker, String message, Object... objects) {
return checkMessage(message);
}
@Override
public Result filter(Logger logger, Level level, Marker marker, Object message, Throwable throwable) {
return checkMessage(message.toString());
}
@Override
public Result filter(Logger logger, Level level, Marker marker, Message message, Throwable throwable) {
return checkMessage(message.getFormattedMessage());
}
@Override
public Result filter(LogEvent logEvent) {
return checkMessage(logEvent.getMessage().getFormattedMessage());
}
}
Atomiz