ozeigermann 2003/12/03 02:59:57
Modified: src/wrappers/log4j Log4jLogger.java
src/share/org/apache/slide/util/logger Logger.java
SimpleLogger.java
Log:
Augmented logging to allow for combined log of text and throwable
Revision Changes Path
1.8 +18 -4 jakarta-slide/src/wrappers/log4j/Log4jLogger.java
Index: Log4jLogger.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/wrappers/log4j/Log4jLogger.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Log4jLogger.java 15 Jan 2003 13:25:47 -0000 1.7
+++ Log4jLogger.java 3 Dec 2003 10:59:56 -0000 1.8
@@ -141,6 +141,20 @@
/**
+ * Log an object and an associated throwable thru the specified channel and
with the specified level.
+ *
+ * @param data object to log
+ * @param throwable throwable to be logged
+ * @param channel channel name used for logging
+ * @param level level used for logging
+ */
+ public void log(Object data, Throwable throwable, String channel, int level) {
+ Category cat = getCategory(channel);
+ cat.log(toPriority(level), data, throwable);
+ }
+
+
+ /**
* Log an object thru the specified channel and with the specified level.
*
* @param data The object to log.
@@ -277,5 +291,5 @@
return result;
}
-
+
}
1.7 +15 -4 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Logger.java 25 Apr 2002 21:30:17 -0000 1.6
+++ Logger.java 3 Dec 2003 10:59:57 -0000 1.7
@@ -232,6 +232,17 @@
/**
+ * Log an object and an associated throwable thru the specified channel and
with the specified level.
+ *
+ * @param data object to log
+ * @param throwable throwable to be logged
+ * @param channel channel name used for logging
+ * @param level level used for logging
+ */
+ public void log(Object data, Throwable throwable, String channel, int level);
+
+
+ /**
* Log an object thru the specified channel and with the specified level.
*
* @param data The object to log.
1.10 +36 -5
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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SimpleLogger.java 25 Apr 2002 21:30:17 -0000 1.9
+++ SimpleLogger.java 3 Dec 2003 10:59:57 -0000 1.10
@@ -156,6 +156,37 @@
/**
+ * Log an object and an associated throwable thru the specified channel and
with the specified level.
+ *
+ * @param data object to log
+ * @param throwable throwable to be logged
+ * @param channel channel name used for logging
+ * @param level level used for logging
+ */
+ public void log(Object data, Throwable throwable, String channel, int level) {
+ if (isEnabled(channel, level)) {
+ String levelValue = "";
+ if (channel.equals(DEFAULT_CHANNEL))
+ channel = "";
+ else
+ channel = channel + " - ";
+ if ((level >= 0) && (level < loggingLevels.length))
+ levelValue = loggingLevels[level];
+ if (dateFormat == null) {
+ System.out.println(System.currentTimeMillis() + " - "
+ + channel + levelValue + " - "
+ + data);
+ } else {
+ System.out.println(dateFormat.format(new Date()) + " - "
+ + channel + levelValue + " - "
+ + data);
+ }
+ throwable.printStackTrace();
+ }
+ }
+
+
+ /**
* Log an object thru the specified channel and with the specified level.
*
* @param data The object to log.
@@ -233,6 +264,6 @@
public boolean isEnabled(int level) {
return isEnabled(DEFAULT_CHANNEL, level);
}
-
-
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]