summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 06dc03656..0ccf6917f 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.protect;
import com.earth2me.essentials.protect.data.IProtectedBlock;
+import com.mchange.v2.log.MLevel;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.logging.Filter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -27,14 +29,20 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
@Override
public void onLoad()
{
- C3P0logger = com.mchange.v2.log.MLog.getLogger(com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.class);
- C3P0logger.setFilter(new Filter()
+ try
+ {
+ // Simple fix for the case that log4j is on the class path by another plugin
+ Class propertyConfiguratorClass = Class.forName("org.apache.log4j.PropertyConfigurator");
+ Properties properties = new Properties();
+ properties.load(this.getClass().getResourceAsStream("log4j.properties"));
+ propertyConfiguratorClass.getMethod("configure", Properties.class).invoke(null, properties);
+ }
+ catch (Exception ex)
{
- public boolean isLoggable(LogRecord lr)
- {
- return lr.getLevel() != Level.INFO;
- }
- });
+ //Ignore me, log4j not found on classloader.
+ }
+ C3P0logger = com.mchange.v2.log.MLog.getLogger(com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.class);
+ C3P0logger.setLevel(MLevel.WARNING);
}
public void onEnable()
@@ -65,7 +73,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
{
final EmergencyListener emListener = new EmergencyListener();
pm.registerEvents(emListener, this);
-
+
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
@@ -89,7 +97,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
{
return ess;
}
-
+
public Map<ProtectConfig, Boolean> getSettingsBoolean()
{
return settingsBoolean;