You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2001/01/24 18:42:36 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/util/logger Logger.java SimpleLogger.java
juergen 01/01/24 09:42:36
Modified: src/share/org/apache/slide/util/logger Logger.java
SimpleLogger.java
Log:
The logger is now pluggable. use <slide logger="org.apache.slide.util.logger.SimpleLogger" logger-level="6"> or the standard domain.xml file to get the default behaviour.
Revision Changes Path
1.2 +19 -10 jakarta-slide/src/share/org/apache/slide/util/logger/Logger.java
Index: Logger.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/Logger.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Logger.java 2000/07/14 16:46:25 1.1
+++ Logger.java 2001/01/24 17:42:28 1.2
@@ -1,13 +1,13 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/Logger.java,v 1.1 2000/07/14 16:46:25 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/07/14 16:46:25 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/Logger.java,v 1.2 2001/01/24 17:42:28 juergen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/01/24 17:42:28 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * 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"
@@ -59,7 +59,7 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.util.logger;
@@ -72,7 +72,7 @@
* The six levels used for logging are (in order of gravity): EMERGENCY,
* CRITICAL, ERROR, WARNING, INFO and DEBUG.
*
- * @version 1.0 (CVS $Revision: 1.1 $ $Date: 2000/07/14 16:46:25 $)
+ * @version 1.0 (CVS $Revision: 1.2 $ $Date: 2001/01/24 17:42:28 $)
* @author <a href="mailto:scoobie@pop.systemy.it">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
@@ -251,5 +251,14 @@
*/
public void log(Object data);
+
+ /**
+ * Log an object.
+ *
+ * @param data The object to log.
+ */
+
+ public void setLoggerLevel(int level);
+
}
1.3 +19 -25 jakarta-slide/src/share/org/apache/slide/util/logger/SimpleLogger.java
Index: SimpleLogger.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/SimpleLogger.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleLogger.java 2000/07/15 01:50:34 1.2
+++ SimpleLogger.java 2001/01/24 17:42:30 1.3
@@ -1,13 +1,13 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/SimpleLogger.java,v 1.2 2000/07/15 01:50:34 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/07/15 01:50:34 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/SimpleLogger.java,v 1.3 2001/01/24 17:42:30 juergen Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/01/24 17:42:30 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * 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"
@@ -59,7 +59,7 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.util.logger;
@@ -69,7 +69,7 @@
/**
* Simple logger implementation.
- *
+ *
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
public class SimpleLogger implements Logger {
@@ -87,7 +87,8 @@
/**
* Date / Time format.
*/
- private SimpleDateFormat dateFormat = null;
+ private SimpleDateFormat dateFormat =
+ new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
/**
@@ -102,7 +103,7 @@
/**
* Logger level setter.
- *
+ *
* @param loggerLevel New logger level
*/
public void setLoggerLevel(int loggerLevel) {
@@ -112,7 +113,7 @@
/**
* Logger level getter.
- *
+ *
* @return int logger level
*/
public int getLoggerLevel() {
@@ -122,7 +123,7 @@
/**
* Date format setter.
- *
+ *
* @param pattern Format pattern
*/
public void setDateFormat(String pattern) {
@@ -130,13 +131,6 @@
}
- /**
- * Use HTTP date format.
- */
- public void useHttpDateFormat() {
- dateFormat =
- new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
- }
// --------------------------------------------------------- Logger Methods
@@ -155,12 +149,12 @@
if ((level >= 0) && (level < loggingLevels.length))
levelValue = loggingLevels[level];
if (dateFormat == null) {
- System.out.println(System.currentTimeMillis() + " - "
- + channel + " - " + levelValue + " - "
+ System.out.println(System.currentTimeMillis() + " - "
+ + channel + " - " + levelValue + " - "
+ data);
} else {
- System.out.println(dateFormat.format(new Date()) + " - "
- + channel + " - " + levelValue + " - "
+ System.out.println(dateFormat.format(new Date()) + " - "
+ + channel + " - " + levelValue + " - "
+ data);
}
}