Author: thomas.diesler(a)jboss.com
Date: 2007-12-20 07:57:48 -0500 (Thu, 20 Dec 2007)
New Revision: 5369
Removed:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JBossLogHandler.java
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JDKLogRedirector.java
Modified:
stack/metro/trunk/src/main/resources/jbossws-sunri-config.xml
Log:
Remove logging stuff that is not stack specific
Deleted:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JBossLogHandler.java
===================================================================
---
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JBossLogHandler.java 2007-12-20
11:27:01 UTC (rev 5368)
+++
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JBossLogHandler.java 2007-12-20
12:57:48 UTC (rev 5369)
@@ -1,146 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.wsf.stack.sunri.log;
-
-import java.util.Map;
-import java.util.logging.ErrorManager;
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
-import java.util.logging.SimpleFormatter;
-
-import org.jboss.logging.Logger;
-
-/**
- * A Handler (java.util.logging.Handler) class redirecting messages
- * to the jboss logging system.
- *
- * @author Alessio Soldano, <alessio.soldano(a)javalinux.it>
- * @author Stefano Maestri, <stefano.maestri(a)javalinux.it>
- * @since 14-Jun-2007
- *
- */
-public class JBossLogHandler extends Handler
-{
- private Map<String, String> levelMap;
- private String defaultLevel;
-
- public JBossLogHandler(Map<String, String> levelMap, String defaultLevel)
- {
- super.setFormatter(new SimpleFormatter());
- this.levelMap = levelMap;
- this.defaultLevel = defaultLevel;
- }
-
- @Override
- public void publish(LogRecord record)
- {
- if (!isLoggable(record))
- {
- return;
- }
- String msg;
- try
- {
- msg = getFormatter().formatMessage(record);
- }
- catch (Exception ex)
- {
- // We don't want to throw an exception here, but we
- // report the exception to any registered ErrorManager.
- reportError(null, ex, ErrorManager.FORMAT_FAILURE);
- return;
- }
-
- String level = levelMap.get(record.getLevel().getName());
- level = level == null ? levelMap.get(record.getLevel().getName().toUpperCase()) :
level;
- level = level == null ? defaultLevel : level;
- if ("info".equalsIgnoreCase(level))
- {
- if (Logger.getLogger(record.getSourceClassName()).isInfoEnabled())
- {
- Logger.getLogger(record.getSourceClassName()).info(msg);
- }
- else
- {
- Logger.getLogger(record.getSourceClassName()).warn("[WAS-INFO]" +
msg);
- }
-
- }
- else if ("error".equalsIgnoreCase(level))
- {
- Logger.getLogger(record.getSourceClassName()).error(msg);
- }
- else if ("warn".equalsIgnoreCase(level))
- {
- Logger.getLogger(record.getSourceClassName()).warn(msg);
- }
- else if ("debug".equalsIgnoreCase(level))
- {
- if (Logger.getLogger(record.getSourceClassName()).isDebugEnabled())
- {
- Logger.getLogger(record.getSourceClassName()).debug(msg);
- }
- else
- {
- Logger.getLogger(record.getSourceClassName()).warn("[WAS-INFO]" +
msg);
- }
- }
- else if ("trace".equalsIgnoreCase(level))
- {
- if (Logger.getLogger(record.getSourceClassName()).isTraceEnabled())
- {
- Logger.getLogger(record.getSourceClassName()).trace(msg);
- }
- else
- {
- Logger.getLogger(record.getSourceClassName()).warn("[WAS-INFO]" +
msg);
- }
- }
- else
- {
- Logger.getLogger(record.getSourceClassName()).warn("[WAS-UNKNOWN]" +
msg);
- }
- }
-
- @Override
- public boolean isLoggable(LogRecord record)
- {
- if (record == null)
- {
- return false;
- }
- return super.isLoggable(record);
- }
-
- @Override
- public void flush()
- {
- //nothing to do
- }
-
- @Override
- public void close() throws SecurityException
- {
- //nothing to do
- }
-
-}
\ No newline at end of file
Deleted:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JDKLogRedirector.java
===================================================================
---
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JDKLogRedirector.java 2007-12-20
11:27:01 UTC (rev 5368)
+++
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/sunri/log/JDKLogRedirector.java 2007-12-20
12:57:48 UTC (rev 5369)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.wsf.stack.sunri.log;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Filter;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-
-import org.jboss.logging.Logger;
-
-/**
- * Redirects JDK Logger output to the JBoss Logger.
- *
- * @author Alessio Soldano, <alessio.soldano(a)javalinux.it>
- * @author Stefano Maestri, <stefano.maestri(a)javalinux.it>
- * @since 14-Jun-2007
- *
- */
-public class JDKLogRedirector
-{
- private List<String> namespaces = new LinkedList<String>();
- private Map<String, String> levelMapping = new HashMap<String, String>();
- private String defaultLevel;
- private static Logger myLogger = Logger.getLogger(JDKLogRedirector.class);
-
- public JDKLogRedirector()
- {
- }
-
- public void changeHandlers()
- {
-
- for (String ns : namespaces)
- {
- changeHandler(ns);
- }
- }
-
- /**
- * Modifies the jdk root logger in order not to log records coming from
- * loggers with the provided namespace; these records are then logged
- * through the JBoss Logger.
- *
- * @param ns
- */
- public void changeHandler(String ns)
- {
- if (ns == null)
- ns = "";
- myLogger.debug("Changing current root logger's log handlers to hide
records with namespace " + ns);
- java.util.logging.Logger jdkRootLogger =
java.util.logging.Logger.getLogger("");
- Handler[] handlers = jdkRootLogger.getHandlers();
- for (int i = 0; i < handlers.length; i++)
- {
- Handler handler = handlers[i];
- if (!(handler instanceof JBossLogHandler))
- {
- StringBuffer sb = new StringBuffer("Disableing handler ");
- sb.append(handler).append(" with level
").append(handler.getLevel());
- myLogger.debug(sb);
- Filter f = handler.getFilter();
- if (f != null && f instanceof NamespaceFilter)
- {
- ((NamespaceFilter)f).addNamespace(ns);
- }
- else
- {
- NamespaceFilter nsFilter = new NamespaceFilter(false);
- nsFilter.addNamespace(ns);
- handler.setFilter(nsFilter);
- }
- }
- }
- myLogger.debug("Adding JBossLogHandler to log records with namespace " +
ns);
- Handler jbossLogHandler = new JBossLogHandler(levelMapping, defaultLevel);
- jbossLogHandler.setLevel(Level.ALL);
- java.util.logging.Logger.getLogger(ns).addHandler(jbossLogHandler);
- }
-
- public void addNamespace(String ns)
- {
- namespaces.add(ns);
- }
-
- public List<String> getNamespaces()
- {
- return namespaces;
- }
-
- public void setNamespaces(List<String> namespaces)
- {
- this.namespaces = namespaces;
- }
-
- public String getDefaultLevel()
- {
- return defaultLevel;
- }
-
- public void setDefaultLevel(String defaultLevel)
- {
- this.defaultLevel = defaultLevel;
-
- }
-
- public Map<String, String> getLevelMapping()
- {
- return levelMapping;
- }
-
- public void setLevelMapping(Map<String, String> levelMapping)
- {
- this.levelMapping = levelMapping;
- }
-
- public String putLevelMappingEntry(String key, String value)
- {
- return levelMapping.put(key, value);
- }
-
- public void start()
- {
- changeHandlers();
- }
-}
Modified: stack/metro/trunk/src/main/resources/jbossws-sunri-config.xml
===================================================================
--- stack/metro/trunk/src/main/resources/jbossws-sunri-config.xml 2007-12-20 11:27:01 UTC
(rev 5368)
+++ stack/metro/trunk/src/main/resources/jbossws-sunri-config.xml 2007-12-20 12:57:48 UTC
(rev 5369)
@@ -30,7 +30,7 @@
</bean>
<!-- Logging redirector -->
- <bean name="JDKLogRedirector"
class="org.jboss.wsf.stack.sunri.log.JDKLogRedirector">
+ <bean name="JDKLogRedirector"
class="org.jboss.wsf.common.log.JDKLogRedirector">
<property name="namespaces">
<list class="java.util.LinkedList"
elementClass="java.lang.String">
<value>javax.enterprise.resource.webservices.jaxws</value>