summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-11-19 22:03:25 +0100
committersnowleo <schneeleo@gmail.com>2012-11-19 22:03:25 +0100
commit0b1625f4c1252734f476a6c4c11bc432dcdd07df (patch)
tree6f3c0deff4ba38bb6cd37cbfcc269030bb388b07
parent1363406b84477db08be0e1bea7bb18cf17999511 (diff)
downloadEssentials-0b1625f4c1252734f476a6c4c11bc432dcdd07df.tar
Essentials-0b1625f4c1252734f476a6c4c11bc432dcdd07df.tar.gz
Essentials-0b1625f4c1252734f476a6c4c11bc432dcdd07df.tar.lz
Essentials-0b1625f4c1252734f476a6c4c11bc432dcdd07df.tar.xz
Essentials-0b1625f4c1252734f476a6c4c11bc432dcdd07df.zip
Better fix for last commit
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java24
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/log4j.properties4
2 files changed, 15 insertions, 13 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 1bd9991a9..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,24 +29,20 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
@Override
public void onLoad()
{
- try {
+ try
+ {
// Simple fix for the case that log4j is on the class path by another plugin
- Class basicConfiguratorClass = Class.forName("org.apache.log4j.BasicConfigurator");
- basicConfiguratorClass.getMethod("configure").invoke(null);
+ 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)
{
//Ignore me, log4j not found on classloader.
}
-
C3P0logger = com.mchange.v2.log.MLog.getLogger(com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.class);
- C3P0logger.setFilter(new Filter()
- {
- public boolean isLoggable(LogRecord lr)
- {
- return lr.getLevel() != Level.INFO;
- }
- });
+ C3P0logger.setLevel(MLevel.WARNING);
}
public void onEnable()
@@ -75,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.");
@@ -99,7 +97,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
{
return ess;
}
-
+
public Map<ProtectConfig, Boolean> getSettingsBoolean()
{
return settingsBoolean;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/log4j.properties b/EssentialsProtect/src/com/earth2me/essentials/protect/log4j.properties
new file mode 100644
index 000000000..2642ee541
--- /dev/null
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/log4j.properties
@@ -0,0 +1,4 @@
+log4j.rootLogger=INFO, A1
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n \ No newline at end of file