User: starksm
Date: 01/04/24 21:09:21
Modified: src/main/org/jboss/logging Log.java LogToCategory.java
Log:
Use the LogToCategory as the default implementation of the Log type
in createLog rather than DefaultLog
Revision Changes Path
1.11 +2 -2 jboss/src/main/org/jboss/logging/Log.java
Index: Log.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/Log.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Log.java 2001/04/24 23:24:24 1.10
+++ Log.java 2001/04/25 04:09:21 1.11
@@ -17,7 +17,7 @@
* @deprecated, As of JBoss 2.3, replaced by the org.apache.log4j framework
* @author Rickard �berg ([EMAIL PROTECTED])
* @author [EMAIL PROTECTED]
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public abstract class Log
{
@@ -93,7 +93,7 @@
public static Log createLog( Object pSource ) {
Log lReturn;
try {
- final String logClass = System.getProperty("JBOSS_LOG_CLASS",
"org.jboss.logging.DefaultLog");
+ final String logClass = System.getProperty("JBOSS_LOG_CLASS",
"org.jboss.logging.LogToCategory");
Class lLog =
Thread.currentThread().getContextClassLoader().loadClass( logClass );
//AS Class lLog = Class.forName( "org.jboss.logging.DefaultLog" );
1.2 +17 -2 jboss/src/main/org/jboss/logging/LogToCategory.java
Index: LogToCategory.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/LogToCategory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogToCategory.java 2001/04/24 23:24:24 1.1
+++ LogToCategory.java 2001/04/25 04:09:21 1.2
@@ -11,20 +11,35 @@
/** An implementation of Log that routes msgs to a
log4j Category. This class is used to replace the Log
instances created via the legacy Log.createLog(Object)
+The Log#log(String, String) method is implemented to send
+pass the message onto the instance log4j Category.
+@see #logToCategory(String, String, Category)
+
@author [EMAIL PROTECTED]
-@version $Revision: 1.1 $
+@version $Revision: 1.2 $
*/
public class LogToCategory extends Log
{
private Category category;
+ /** Wraps a log4j Category object to expose it as a legacy Log instance.
+ */
public LogToCategory(Category category)
{
super(category.getName());
this.category = category;
}
+ /** A compatability contstructor that allows the Log.createLog(Object)
+ to use the LogToCategory as the default type of Log. This
+ ctor create a log4j Category using Category.getInstance(source.toString())
+ */
+ public LogToCategory(Object source)
+ {
+ super(source);
+ this.category = Category.getInstance(source.toString());
+ }
- public synchronized void log(String type, String message)
+ public void log(String type, String message)
{
logToCategory(type, message, category);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development