User: andreas
Date: 00/12/07 10:16:13
Modified: src/main/org/jboss/logging ConsoleLogging.java Log.java
ViewerLogging.java
Added: src/main/org/jboss/logging DefaultLog.java
Log:
Changes to ServiceMBean therefore that if the Default-
Log class is not available then it does not logging.
Thus I could extract the JMX Connector (server-side)
from jBoss therefore that it can be used elsewhere.
Both (server- and client-side) connector archives are then
put in the new directory external which should keep all
archives developed under jBoss but available to other
groups.
Revision Changes Path
1.7 +2 -2 jboss/src/main/org/jboss/logging/ConsoleLogging.java
Index: ConsoleLogging.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/logging/ConsoleLogging.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConsoleLogging.java 2000/12/07 15:44:58 1.6
+++ ConsoleLogging.java 2000/12/07 18:16:12 1.7
@@ -21,7 +21,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class ConsoleLogging
implements ConsoleLoggingMBean, NotificationListener, MBeanRegistration
@@ -35,7 +35,7 @@
boolean verbose = false;
- Log log = new Log("Console logging");
+ Log log = new DefaultLog("Console logging");
String filter = "Information,Debug,Warning,Error";
1.6 +33 -8 jboss/src/main/org/jboss/logging/Log.java
Index: Log.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/logging/Log.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Log.java 2000/12/07 15:44:58 1.5
+++ Log.java 2000/12/07 18:16:12 1.6
@@ -17,9 +17,9 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
-public class Log
+public abstract class Log
{
// Constants -----------------------------------------------------
@@ -44,9 +44,9 @@
return null;
}
};
+
+ protected static Log defaultLog;
- static Log defaultLog = new Log();
-
public static void setLog(Log log)
{
Stack s;
@@ -77,6 +77,20 @@
Stack s = (Stack)currentLog.get();
return s == null ? defaultLog : (Log)s.peek();
}
+
+ public static Log createLog( Object pSource ) {
+ Log lReturn;
+ try {
+ Class lLog = Class.forName( "org.jboss.logging.DefaultLog" );
+ lReturn = (Log) lLog.getConstructor( new Class[] {
Object.class } ).newInstance(
+ new Object[] { pSource }
+ );
+ }
+ catch( Exception e ) {
+ lReturn = new Log.NoLog( pSource );
+ }
+ return lReturn;
+ }
// Constructors --------------------------------------------------
public Log()
@@ -90,10 +104,7 @@
}
// Public --------------------------------------------------------
- public synchronized void log(String type, String message)
- {
- Logger.getLogger().fireNotification(type, source, message);
- }
+ public abstract void log(String type, String message);
public synchronized void log(String message)
{
@@ -154,5 +165,19 @@
{
return count++;
}
+
+ public static class NoLog extends Log {
+ public NoLog() {
+ super();
+ }
+ public NoLog( Object pSource ) {
+ super( pSource );
+ }
+ public Log getDefault() {
+ return new NoLog();
+ }
+ public synchronized void log( String pType, String pMessage ) {
+ }
+ }
}
1.5 +3 -2 jboss/src/main/org/jboss/logging/ViewerLogging.java
Index: ViewerLogging.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/logging/ViewerLogging.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ViewerLogging.java 2000/12/07 15:44:58 1.4
+++ ViewerLogging.java 2000/12/07 18:16:12 1.5
@@ -18,7 +18,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class ViewerLogging
implements ViewerLoggingMBean, MBeanRegistration, NotificationListener
@@ -29,7 +29,7 @@
PrintStream out;
DateFormat fmt = new SimpleDateFormat();
- Log log = new Log("Viewer logging");
+ Log log = new DefaultLog("Viewer logging");
DefaultTableModel tableModel;
@@ -113,4 +113,5 @@
public void postDeregister() {}
}
+
1.1 jboss/src/main/org/jboss/logging/DefaultLog.java
Index: DefaultLog.java
===================================================================
/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.jboss.logging;
import java.io.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
import javax.management.*;
/**
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class DefaultLog extends Log
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
static {
Log.defaultLog = new DefaultLog();
}
// Constructors --------------------------------------------------
public DefaultLog()
{
super();
}
public DefaultLog(Object source)
{
super( source );
}
// Public --------------------------------------------------------
public synchronized void log(String type, String message)
{
Logger.getLogger().fireNotification(type, source, message);
}
// Private -------------------------------------------------------
}