aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Log.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/helper/Log.java')
-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);
+ }
+
+ }
+
}