Fix [WorldGuard] in log messages stacking on reloads.

Fixes WORLDGUARD-3192.
This commit is contained in:
sk89q 2014-11-11 00:29:25 -08:00
parent df985013eb
commit c7442c2a9e

View File

@ -62,9 +62,12 @@ public void close() throws SecurityException {
public static void register(Logger logger, String prefix) {
checkNotNull(logger);
// Fix issues with multiple classloaders loading the same class
String className = RecordMessagePrefixer.class.getCanonicalName();
logger.setUseParentHandlers(false);
for (Handler handler : logger.getHandlers()) {
if (handler instanceof RecordMessagePrefixer) {
if (handler.getClass().getCanonicalName().equals(className)) {
logger.removeHandler(handler);
}
}