You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by ja...@apache.org on 2003/11/01 17:16:00 UTC
cvs commit: ws-wsrp4j/src/org/apache/wsrp4j/log LogManager.java
jacob 2003/11/01 08:16:00
Modified: src/org/apache/wsrp4j/log LogManager.java
Log:
removed dependency on servlet.jar when running SwingConsumer on JDK1.4
Revision Changes Path
1.2 +56 -91 ws-wsrp4j/src/org/apache/wsrp4j/log/LogManager.java
Index: LogManager.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/log/LogManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogManager.java 3 Sep 2003 20:29:29 -0000 1.1
+++ LogManager.java 1 Nov 2003 16:16:00 -0000 1.2
@@ -1,62 +1,57 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "WSRP4J", and "Apache Software
- * Foundation" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
- * without prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
-
- */
-
-
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSRP4J", and "Apache Software
+ * Foundation" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
+ * without prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.wsrp4j.log;
import java.io.InputStream;
@@ -71,9 +66,6 @@
private static final String LOG_PROPERTIES_FILE = "wsrp4j-logger.properties";
private static final String PROPERTY_PREFIX = "wsrp4j.logger.";
private static final String GLOBAL_LOG_LEVEL_PROPERTY = "wsrp4j.logger";
- private static final String FILE_SEPARATOR = System.getProperty("file.separator");
- private static final String PROPERTY_DIR_IN_MODULE = "WEB-INF" + FILE_SEPARATOR + "config";
-
private static int globalLogLevel = Logger.ERROR;
private static Properties wsrp4jLevels = new Properties();
private static LogManager logManager = new LogManager();
@@ -83,34 +75,10 @@
*/
private LogManager()
{
- //very dirty hack :-(
-
- //determine log properties from file
- String propFileName;
- boolean producerEnvironment = true;
- try
- { //try to get a path from ServletAccess
-
- javax.servlet.ServletContext servletContext =
- org.apache.wsrp4j.producer.util.ServletAccess.getServletContext();
-
- String path = servletContext.getRealPath("/");
-
- propFileName = path + PROPERTY_DIR_IN_MODULE + FILE_SEPARATOR + LOG_PROPERTIES_FILE;
- } catch (Throwable t)
- { //catch runtime class not found exception if not running in a web module environment
- propFileName = LOG_PROPERTIES_FILE;
- producerEnvironment = false;
- }
- try
+ try
{
InputStream propertiesInputStream;
- //if(producerEnvironment){
- // propertiesInputStream = new FileInputStream(propFileName);
- //}
- //else{//consumerEnvironment
propertiesInputStream = this.getClass().getClassLoader().getResourceAsStream(LOG_PROPERTIES_FILE);
- //}
wsrp4jLevels.load(propertiesInputStream);
} catch (Exception e)
{
@@ -123,7 +91,7 @@
org.apache.log4j.PropertyConfigurator.configure(wsrp4jLevels);
//log used properties file
- org.apache.log4j.Logger.getLogger(this.getClass()).info("Logger.properties file: " + propFileName);
+ org.apache.log4j.Logger.getLogger(this.getClass()).info("Logger.properties file: " + LOG_PROPERTIES_FILE);
//initialize wsrp4j-logger levels from properties
int userDefinedGlobalLevel =
@@ -168,14 +136,11 @@
//determine log level for aClass
String propertyName = PROPERTY_PREFIX + aClass.getName();
- //org.apache.log4j.Logger.getLogger(this.getClass()).info(wsrp4jLevels.keySet());
- //org.apache.log4j.Logger.getLogger(this.getClass()).info("Look up Properties: " + propertyName);
int level = globalLogLevel;
int userDefinedLevel = getLevelFromString((String)wsrp4jLevels.getProperty(propertyName));
if (userDefinedLevel != 0)
{
level = userDefinedLevel;
- //org.apache.log4j.Logger.getLogger(this.getClass()).info("Property found: " + propertyName + " Value=" + level);
}
return new LoggerImpl(logger, level);
}