Author: thomas.diesler(a)jboss.com
Date: 2007-12-20 10:50:05 -0500 (Thu, 20 Dec 2007)
New Revision: 5377
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogHandler.java
common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogRedirector.java
Log:
Fix exception logging
Modified: common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogHandler.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogHandler.java 2007-12-20
14:55:37 UTC (rev 5376)
+++ common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogHandler.java 2007-12-20
15:50:05 UTC (rev 5377)
@@ -54,30 +54,32 @@
{
Logger logger = getJBossLogger(record);
Level level = record.getLevel();
+ Throwable th = record.getThrown();
+
if (level == Level.FINER || level == Level.FINEST)
{
String msg = getMessage(record);
- logger.trace(msg);
+ logger.trace(msg, th);
}
else if (level == Level.FINE)
{
String msg = getMessage(record);
- logger.debug(msg);
+ logger.debug(msg, th);
}
- else if (level == Level.INFO || level == Level.CONFIG)
+ else if (level == Level.INFO || level == Level.CONFIG || level == Level.ALL)
{
String msg = getMessage(record);
- logger.info(msg);
+ logger.info(msg, th);
}
else if (level == Level.WARNING)
{
String msg = getMessage(record);
- logger.warn(msg);
+ logger.warn(msg, th);
}
else if (level == Level.SEVERE)
{
String msg = getMessage(record);
- logger.error(msg);
+ logger.error(msg, th);
}
else if (level == Level.OFF)
{
@@ -126,7 +128,7 @@
{
isLoggable = logger.isInfoEnabled();
}
- else if (level == Level.SEVERE || level == Level.WARNING)
+ else if (level == Level.SEVERE || level == Level.WARNING || level == Level.ALL)
{
isLoggable = true;
}
Modified: common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogRedirector.java
===================================================================
---
common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogRedirector.java 2007-12-20
14:55:37 UTC (rev 5376)
+++
common/trunk/src/main/java/org/jboss/wsf/common/logging/JDKLogRedirector.java 2007-12-20
15:50:05 UTC (rev 5377)
@@ -24,8 +24,10 @@
import java.util.LinkedList;
import java.util.List;
import java.util.logging.ConsoleHandler;
+import java.util.logging.Filter;
import java.util.logging.Handler;
import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
import java.util.logging.Logger;
/**
@@ -57,11 +59,11 @@
public void start()
{
- removeRootConsoleHandler();
+ modifyRootLogger();
addNamespaceHandlers();
}
- private void removeRootConsoleHandler()
+ private void modifyRootLogger()
{
LogManager logManager = LogManager.getLogManager();
Logger root = logManager.getLogger("");
@@ -73,7 +75,22 @@
{
Handler handler = handlers[i];
if (handler instanceof ConsoleHandler)
- root.removeHandler(handler);
+ {
+ Filter filter = new Filter()
+ {
+ public boolean isLoggable(LogRecord record)
+ {
+ String name = record.getLoggerName();
+ for (String ns : namespaces)
+ {
+ if (name.startsWith(ns))
+ return false;
+ }
+ return true;
+ }
+ };
+ handler.setFilter(filter);
+ }
}
}
Show replies by date