Update of /cvsroot/opensymphony/clickstream/src/com/opensymphony/clickstream/config
In directory sc8-pr-cvs1:/tmp/cvs-serv18926/clickstream/src/com/opensymphony/clickstream/config
Modified Files:
ClickstreamConfig.java ConfigLoader.java
Log Message:
Fixed CLK-9, switched over to commons logging and did some cosmetics..
Index: ClickstreamConfig.java
===================================================================
RCS file: /cvsroot/opensymphony/clickstream/src/com/opensymphony/clickstream/config/ClickstreamConfig.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ClickstreamConfig.java 8 Jun 2002 10:15:18 -0000 1.1
+++ ClickstreamConfig.java 2 Sep 2003 09:40:47 -0000 1.2
@@ -1,9 +1,3 @@
-/*
- * Created by IntelliJ IDEA.
- * User: plightbo
- * Date: Jun 8, 2002
- * Time: 1:37:24 AM
- */
package com.opensymphony.clickstream.config;
import java.util.List;
Index: ConfigLoader.java
===================================================================
RCS file: /cvsroot/opensymphony/clickstream/src/com/opensymphony/clickstream/config/ConfigLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ConfigLoader.java 8 Jun 2002 10:15:18 -0000 1.1
+++ ConfigLoader.java 2 Sep 2003 09:40:47 -0000 1.2
@@ -1,6 +1,7 @@
package com.opensymphony.clickstream.config;
-import com.opensymphony.util.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -18,8 +19,8 @@
* @author <a href="[email protected]">Patrick Lightbody</a>
*/
public class ConfigLoader {
+ private static final Log log = LogFactory.getLog(ConfigLoader.class);
- private static final Logger logger = new Logger(ConfigLoader.class);
private ClickstreamConfig config;
private static ConfigLoader singleton;
@@ -54,24 +55,29 @@
config = new ClickstreamConfig();
try {
- logger.debug("Loading config");
+ log.debug("Loading config");
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(is, new ConfigHandler());
return config;
- } catch (SAXException e) {
- logger.error("Could not parse config XML", e);
+ }
+ catch (SAXException e) {
+ log.error("Could not parse config XML", e);
throw new RuntimeException(e.getMessage());
- } catch (IOException e) {
- logger.error("Could not read config from stream", e);
+ }
+ catch (IOException e) {
+ log.error("Could not read config from stream", e);
throw new RuntimeException(e.getMessage());
- } catch (ParserConfigurationException e) {
- logger.fatal("Could not obtain SAX parser", e);
+ }
+ catch (ParserConfigurationException e) {
+ log.fatal("Could not obtain SAX parser", e);
throw new RuntimeException(e.getMessage());
- } catch (RuntimeException e) {
- logger.fatal("RuntimeException", e);
+ }
+ catch (RuntimeException e) {
+ log.fatal("RuntimeException", e);
throw e;
- } catch (Throwable e) {
- logger.fatal("Exception", e);
+ }
+ catch (Throwable e) {
+ log.fatal("Exception", e);
throw new RuntimeException(e.getMessage());
}
}
@@ -82,11 +88,13 @@
*/
private class ConfigHandler extends DefaultHandler {
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if (qName.equals("logger")) {
+ if (qName.equals("log")) {
config.setLoggerClass(attributes.getValue("class"));
- } else if (qName.equals("bot-host")) {
+ }
+ else if (qName.equals("bot-host")) {
config.addBotHost(attributes.getValue("name"));
- } else if (qName.equals("bot-agent")) {
+ }
+ else if (qName.equals("bot-agent")) {
config.addBotAgent(attributes.getValue("name"));
}
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.