User: kimptoc Date: 01/09/01 12:50:32 Modified: src/main/org/jboss/logging Log.java Logger.java Log: remove deprecated logging import, where possible, otherwise comment as needing replacement with log4j.... must find out how it is use.... would be good if the deprecation message pointed to an example to use... Revision Changes Path 1.15 +47 -47 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Log.java 2001/08/03 17:15:53 1.14 +++ Log.java 2001/09/01 19:50:32 1.15 @@ -16,10 +16,10 @@ import org.apache.log4j.NDC; /** The legacy JBoss logging framework base class. - * @deprecated, As of JBoss 2.3, replaced by the org.apache.log4j framework + * @deprecated, As of JBoss 2.3, replaced by the org.apache.log4j framework. TODO Example of how to use log4j * @author <a href="mailto:[EMAIL PROTECTED]">Rickard Öberg</a> * @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>. - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ public abstract class Log { @@ -41,17 +41,17 @@ static ThreadLocal currentLog = new InheritableThreadLocal() { - // Child threads should get same stack, but only a copy of it - public Object childValue(Object obj) - { - if (obj != null) - return ((Stack)obj).clone(); - else - return null; - } + // Child threads should get same stack, but only a copy of it + public Object childValue(Object obj) + { + if (obj != null) + return ((Stack)obj).clone(); + else + return null; + } }; - protected static Log defaultLog; + protected static Log defaultLog; public static void setLog(Log log) { @@ -83,33 +83,33 @@ public static Log getLog() { Stack s = (Stack)currentLog.get(); - if( s == null ) { - if( defaultLog == null ) { - defaultLog = createLog( "Default" ); - } - return defaultLog; - } - else { - return (Log)s.peek(); - } + if( s == null ) { + if( defaultLog == null ) { + defaultLog = createLog( "Default" ); + } + return defaultLog; + } + else { + return (Log)s.peek(); + } } - public static Log createLog( Object pSource ) { - Log lReturn; - try { + public static Log createLog( Object pSource ) { + Log lReturn; + try { 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" ); - lReturn = (Log) lLog.getConstructor( new Class[] { Object.class } ).newInstance( - new Object[] { pSource } - ); - } - catch( Exception e ) { - lReturn = new Log.NoLog( pSource ); - } - return lReturn; - } + Class lLog = Thread.currentThread().getContextClassLoader().loadClass( logClass ); +//AS 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() @@ -194,18 +194,18 @@ 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 ) { - } - } + 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.12 +52 -52 jboss/src/main/org/jboss/logging/Logger.java Index: Logger.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/Logger.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Logger.java 2001/08/30 03:57:44 1.11 +++ Logger.java 2001/09/01 19:50:32 1.12 @@ -14,30 +14,30 @@ import javax.management.*; /** - * @deprecated, As of JBoss 2.3, replaced by the org.apache.log4j framework + * @deprecated, As of JBoss 2.3, replaced by the org.apache.log4j framework. TODO Example of how to use log4j * @author <a href="mailto:[EMAIL PROTECTED]">Rickard Öberg</a> * @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>. - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ public class Logger extends NotificationBroadcasterSupport implements LoggerMBean, MBeanRegistration, NotificationBroadcaster, Runnable { // Constants ----------------------------------------------------- - + // Attributes ---------------------------------------------------- long sequence = 0; Date now = new Date(); - - boolean running = true; - + + boolean running = true; + ArrayList notificationListeners = new ArrayList(); - + // Static -------------------------------------------------------- static Logger logger; - + public static Logger getLogger() { return logger; } - + public static void log(String type, String message) { Log l = (Log)Log.getLog(); @@ -61,7 +61,7 @@ Log l = (Log)Log.getLog(); l.warning(message); } - + public static void debug(String message) { Log l = (Log)Log.getLog(); @@ -73,75 +73,75 @@ Log l = (Log)Log.getLog(); l.debug(exception); } - - public static void error(String message) + + public static void error(String message) { - Log l = (Log) Log.getLog(); - l.error(message); + Log l = (Log) Log.getLog(); + l.error(message); } - - - public static void error(Throwable exception) + + + public static void error(Throwable exception) { - Log l = (Log) Log.getLog(); - l.error(exception.toString()); + Log l = (Log) Log.getLog(); + l.error(exception.toString()); } - + // Constructors -------------------------------------------------- public Logger() { logger = this; - - Thread runner = new Thread(this, "Log time updater"); - runner.setDaemon(true); - runner.start(); + + Thread runner = new Thread(this, "Log time updater"); + runner.setDaemon(true); + runner.start(); } - + // Public -------------------------------------------------------- public synchronized void fireNotification(String type, Object source, String message) { //AS FIXME Just a hack (now.getTime()) - Notification n = new Notification(type, this, sequence++, now.getTime(), message); + Notification n = new Notification(type, this, sequence++, now.getTime(), message); n.setUserData(source); - + sendNotification(n); } - + // MBeanRegistration implementation ------------------------------ public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception { return name == null ? new ObjectName("JBOSS-SYSTEM:spine=Log") : name; } - - public void postRegister(java.lang.Boolean registrationDone) + + public void postRegister(java.lang.Boolean registrationDone) { } - + public void preDeregister() - throws java.lang.Exception + throws java.lang.Exception {} - - public void postDeregister() - { - running = false; - } + + public void postDeregister() + { + running = false; + } // Runnable implementation --------------------------------------- - public void run() - { - while (running) - { - now.setTime(System.currentTimeMillis()); - - try - { - Thread.sleep(5*1000); - } catch (InterruptedException e) - { - // Ignore - } - } - } + public void run() + { + while (running) + { + now.setTime(System.currentTimeMillis()); + + try + { + Thread.sleep(5*1000); + } catch (InterruptedException e) + { + // Ignore + } + } + } } _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development