aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-08-23 21:00:09 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-08-23 21:00:09 +1200
commit63d1859cde9c8f3fb9bc85e0c202750bda8d975e (patch)
tree7564fa5419f14d72a9853f52f7b76dbaf101e5c2 /src/org/traccar/helper
parentcaa4fd747981075ed47315fffc5bbd18268278bd (diff)
downloadtraccar-server-63d1859cde9c8f3fb9bc85e0c202750bda8d975e.tar.gz
traccar-server-63d1859cde9c8f3fb9bc85e0c202750bda8d975e.tar.bz2
traccar-server-63d1859cde9c8f3fb9bc85e0c202750bda8d975e.zip
Netty logger implementation
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/Log.java76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java
index 3c173f71e..d14a7b0bb 100644
--- a/src/org/traccar/helper/Log.java
+++ b/src/org/traccar/helper/Log.java
@@ -24,6 +24,9 @@ import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
+import org.jboss.netty.logging.AbstractInternalLogger;
+import org.jboss.netty.logging.InternalLogger;
+import org.jboss.netty.logging.InternalLoggerFactory;
public class Log {
@@ -42,6 +45,14 @@ public class Log {
logger = Logger.getLogger(LOGGER_NAME);
logger.addAppender(appender);
logger.setLevel(Level.ALL);
+
+ // Workaround for "Bug 745866 - (EDG-45) Possible netty logging config problem"
+ InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory() {
+ @Override
+ public InternalLogger newInstance(String string) {
+ return new NettyInternalLogger();
+ }
+ });
}
public static Logger getLogger() {
@@ -97,4 +108,69 @@ public class Log {
getLogger().debug(msg);
}
+ /**
+ * Netty logger implementation
+ */
+ private static class NettyInternalLogger extends AbstractInternalLogger {
+
+ @Override
+ public boolean isDebugEnabled() {
+ return false;
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return false;
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return true;
+ }
+
+ @Override
+ public void debug(String string) {
+ debug(string, null);
+ }
+
+ @Override
+ public void debug(String string, Throwable thrwbl) {
+ }
+
+ @Override
+ public void info(String string) {
+ info(string, null);
+ }
+
+ @Override
+ public void info(String string, Throwable thrwbl) {
+ }
+
+ @Override
+ public void warn(String string) {
+ warn(string, null);
+ }
+
+ @Override
+ public void warn(String string, Throwable thrwbl) {
+ getLogger().warn("netty warning: " + string);
+ }
+
+ @Override
+ public void error(String string) {
+ error(string, null);
+ }
+
+ @Override
+ public void error(String string, Throwable thrwbl) {
+ getLogger().error("netty error: " + string);
+ }
+
+ }
+
}