diff options
author | Jonathan Bauer | 2014-12-01 16:30:47 +0100 |
---|---|---|
committer | Jonathan Bauer | 2014-12-01 16:30:47 +0100 |
commit | 075f086d3211f6f347e7366a5d5f78e2b73c850e (patch) | |
tree | a7e743f935ec03c5a26adb6e029f5cdda725d528 /src | |
parent | Removed Rhino support, cleaned up pom.xml (diff) | |
download | proxy-vole-075f086d3211f6f347e7366a5d5f78e2b73c850e.tar.gz proxy-vole-075f086d3211f6f347e7366a5d5f78e2b73c850e.tar.xz proxy-vole-075f086d3211f6f347e7366a5d5f78e2b73c850e.zip |
hack: log4j logger support
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/btr/proxy/search/ProxySearch.java | 11 | ||||
-rw-r--r-- | src/main/java/com/btr/proxy/util/Logger.java | 22 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/main/java/com/btr/proxy/search/ProxySearch.java b/src/main/java/com/btr/proxy/search/ProxySearch.java index 19db95f..67fa0cf 100644 --- a/src/main/java/com/btr/proxy/search/ProxySearch.java +++ b/src/main/java/com/btr/proxy/search/ProxySearch.java @@ -241,17 +241,6 @@ public class ProxySearch implements ProxySearchStrategy { public static void main(String[] args) { ProxySearch ps = ProxySearch.getDefaultProxySearch(); - Logger.setBackend(new LogBackEnd() { - - public void log(Class<?> clazz, LogLevel loglevel, String msg, - Object... params) { - System.out.println(MessageFormat.format(msg, params)); - } - - public boolean isLogginEnabled(LogLevel logLevel) { - return true; - } - }); ps.getProxySelector(); } diff --git a/src/main/java/com/btr/proxy/util/Logger.java b/src/main/java/com/btr/proxy/util/Logger.java index f434699..00c1037 100644 --- a/src/main/java/com/btr/proxy/util/Logger.java +++ b/src/main/java/com/btr/proxy/util/Logger.java @@ -2,6 +2,11 @@ package com.btr.proxy.util; import java.text.MessageFormat; +import org.apache.log4j.Priority; + +import com.btr.proxy.search.ProxySearch; + + /***************************************************************************** * Simple logging support for the framework. * You need to add an logging listener that needs to send the logging events @@ -68,7 +73,22 @@ public class Logger { ************************************************************************/ public static void log(Class<?> clazz, LogLevel loglevel, String msg, Object ...params) { - System.out.println(MessageFormat.format(msg, params)); + Priority priority; + switch(loglevel) { + case ERROR: + priority = Priority.DEBUG; + break; + case WARNING: + priority = Priority.WARN; + break; + case INFO: + priority = Priority.INFO; + break; + default: + priority = Priority.DEBUG; + } + org.apache.log4j.Logger.getLogger(clazz).log( + clazz.getCanonicalName(), priority, MessageFormat.format(msg, params), null); } /************************************************************************* |