jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r723430 - in /incubator/jspwiki/trunk: ./ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/log/ src/com/ecyrd/jspwiki/ui/admin/
Date Thu, 04 Dec 2008 20:46:24 GMT
Author: metskem
Date: Thu Dec  4 12:46:24 2008
New Revision: 723430

URL: http://svn.apache.org/viewvc?rev=723430&view=rev
Log:
3.0.0-svn-23 implemented the unregisterAllLoggerMBeans method in the LoggerFactory triggered
from WikiEngine.shutdown(), 
 added some more robustness to LoggerFactory, 
 made the LoggerImpl Serializable, 
 added a note to the ReleaseNotes, 
 we should also do something with the UPGRADING document, what would be the best way to structure
it  ?

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/ReleaseNotes
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiEngine.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerFactory.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerImpl.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Thu Dec  4 12:46:24 2008
@@ -1,3 +1,13 @@
+2008-11-29 Harry Metske <metskem@apache.org>
+
+        * 3.0.0-svn-23
+        
+        * implemented the unregisterAllLoggerMBeans method in the LoggerFactory
+        * added some more robustness to LoggerFactory
+        * made the LoggerImpl Serializable
+        * added a note to the ReleaseNotes
+        
+        
 2008-12-04  Janne Jalkanen <jalkanen@apache.org>
 
         * 3.0.0-svn-22

Modified: incubator/jspwiki/trunk/ReleaseNotes
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ReleaseNotes?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ReleaseNotes (original)
+++ incubator/jspwiki/trunk/ReleaseNotes Thu Dec  4 12:46:24 2008
@@ -1,13 +1,10 @@
 
-Welcome to the stable version of JSPWiki 2.8!
+Welcome to the stable version of JSPWiki 3.0!
 
 This is the first version of JSPWiki which is released completely under
 the Apache License.  This is done as a part of the transition to the
 Apache Incubation.
 
-However, this is NOT an Apache release - JSPWiki 3.0 will be the first
-official Apache release.
-
 Please report any issues you can find at http://issues.apache.org/JIRA/
 
 
@@ -18,31 +15,20 @@
 
 * Simplified Chinese, Dutch and Italian localizations added!
 
-* There is no more need for JAAS files!  Hooray!  This has
-  been replaced with custom jspwiki properties.  Please see
-  the UPGRADING document.
-
-* Massive improvements to the default template, like
-  section editing.
-  
-* Sneak preview in the default editor
-
-* WikiWizard is removed (it is LGPL), but FCK integration is available,
-  and WikiWizard can still be installed as a separate package.
-
-* German, Finnish, Spanish, Simplified Chinese and Dutch language corepages
-
-* Support for the UniversalEditButton (http://universaleditbutton.org/).
-
-* Password hashes are now salted.  This means you can't share the passwords
-  if you have JSPWiki 2.6 instances, as the passwords are upgraded
-  transparently.
+* Logging by JSPWiki is now done with slf4j, see http://www.slf4j.org for details.
+  You can now decide at runtime which logging implementation you want, just pick
+  the right slf4j implementation and drop it in WEB-INF/lib
+  The default implementation is log4j, so you don't have to switch to anything else unless

+  you have a good reason.
+  The log4j configuration statements have been moved to a separate file log4j.properties,

+  this file should be on your CLASSPATH, by default it is placed in WEB-INF/classes
 
 The full log of any issues fixed can be found at:
 
 https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310732&styleName=Html&version=12312864
+			  ==> how to get this to 3.0 ?
 
-Please also see http://www.jspwiki.org/wiki/NewIn2.8
+Please also see http://www.jspwiki.org/wiki/NewIn3.0
 
 UPGRADE NOTES
 =============
@@ -53,29 +39,7 @@
 EXPERIMENTAL FEATURES
 =====================
 
-There are some features in this release which could mostly be considered
-experimental at best.  The following ones are known to work only
-partially:
-
-* WebDAV support.  This is known to be broken on pretty many levels...
-
-* Admin interface.  Check out /admin/Admin.jsp.
 
 KNOWN PROBLEMS
 ==============
 
-* WebDav does not yet support the new
-  authentication/permissions scheme.  Therefore, if you have very
-  sensitive data in your wiki, you might not want to enable it.
-
-* Not all old plugins work.  Specifically any plugins, which construct 
-  new WikiPages will fail because of the constructor has been changed.
-
-* The PageFilter API was changed in 2.6
-
-* Our documentation simply sucks at this point.  Please forgive us,
-  and point where those fixes are needed.  We will improve upon
-  based your input.
-
-* The ShortURLConstructor does not work reliably.  Please use
-  ShortViewURLConstructor, or Apache mod_rewrite.

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java Thu Dec  4 12:46:24 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "22";
+    public static final String     BUILD         = "23";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiEngine.java?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiEngine.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiEngine.java Thu Dec  4 12:46:24 2008
@@ -1531,6 +1531,7 @@
     {
         fireEvent( WikiEngineEvent.SHUTDOWN );
         m_filterManager.destroy();
+        LoggerFactory.unRegisterAllLoggerMBeans();
     }
 
     /**

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerFactory.java?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerFactory.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerFactory.java Thu Dec  4 12:46:24
2008
@@ -24,7 +24,9 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.HashMap;
+import java.util.Set;
 
+import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.slf4j.bridge.SLF4JBridgeHandler;
@@ -50,7 +52,10 @@
  */
 public final class LoggerFactory
 {
-    private static boolean c_log4jPresent = true;
+    private static boolean c_isLog4jPresent = true;
+    
+    //     it appears that after shutting down JSPWiki, we get new requests for Loggers,
to prevent this we "close the door" :
+    private static boolean c_isLoggerFactoryClosed= false;
 
     private static final String SLF4J_LOG4J_ADAPTER_CLASS = "org.slf4j.impl.Log4jLoggerAdapter";
 
@@ -58,6 +63,12 @@
 
     private static HashMap<String, LoggerImpl> c_registeredLoggers = new HashMap<String,
LoggerImpl>( 200 );
 
+    /**
+     *   @TODO  We need something here to make the Logger MBeans unique across the JVM, this
will not work if you
+     *                     run multiple wiki's in the same JVM, same is true for other MBeans.

+     */
+    private static final String OBJECTNAME_PREFIX = Release.APPNAME + ":component=Loggers,name=";
+
     static
     {
         SLF4JBridgeHandler.install();
@@ -68,6 +79,19 @@
      */
     private LoggerFactory()
     {}
+
+
+    /**
+     *  Utility method for locating a Logger based on a Class.
+     *  
+     *  @param clazz The Class to find a Logger for.
+     *  @return A Logger instance.
+     */
+    public static final Logger getLogger( Class clazz )
+    {
+        return getLogger( clazz.getName() );
+    }
+
     
     /**
      * Returns a Logger instance, and also, if it is a Log4J logger, registers the Logging
MBean.
@@ -77,11 +101,16 @@
      */
     public static final synchronized Logger getLogger( String loggerName )
     {
+        if( c_isLoggerFactoryClosed )
+        {
+            return null;
+        }
+        
         if( c_registeredLoggers.get( loggerName ) == null )
         {
             LoggerImpl logger = new LoggerImpl( loggerName );
             c_registeredLoggers.put( loggerName, logger );
-            if( c_log4jPresent )
+            if( c_isLog4jPresent )
             {
                 registerLoggerMBean( loggerName );
             }
@@ -130,13 +159,17 @@
             Constructor constr = mbeanClass.getConstructor( loggerClass );
             Object dynMBean = constr.newInstance( arglist );
             ObjectName mbeanName = new ObjectName( Release.APPNAME + ":component=Loggers,name="
+ loggerName );
-            ManagementFactory.getPlatformMBeanServer().registerMBean( dynMBean, mbeanName
);
+            MBeanServer mbeanServer =  ManagementFactory.getPlatformMBeanServer();
+            if( !mbeanServer.isRegistered( mbeanName ) )
+            {
+                mbeanServer.registerMBean( dynMBean, mbeanName );
+            }
         }
         catch( ClassNotFoundException cnfe )
         {
             // apparently we cannot find the slf4j log4j adapter, so we assume there is no
log4j
             // available, so there is no use in registering MBeans
-            c_log4jPresent = false;
+            c_isLog4jPresent = false;
             System.err.println( "Could not find class " +SLF4J_LOG4J_ADAPTER_CLASS + ", so
no dynamic log configuration here :-(" );
         }
         catch( Exception e )
@@ -145,14 +178,26 @@
         }
     }
 
+    
     /**
-     *  Utility method for locating a Logger based on a Class.
-     *  
-     *  @param clazz The Class to find a Logger for.
-     *  @return A Logger instance.
+     * UnRegisters all Logger MBeans from the Platform MBeanServer.
      */
-    public static final Logger getLogger( Class clazz )
+    public static void unRegisterAllLoggerMBeans()
     {
-        return getLogger( clazz.getName() );
+        c_isLoggerFactoryClosed = true;
+
+        Set<String> loggerNames = c_registeredLoggers.keySet();
+        for( String loggerName : loggerNames )
+        {
+            try
+            {
+                ObjectName mbeanName = new ObjectName( OBJECTNAME_PREFIX + loggerName );
+                ManagementFactory.getPlatformMBeanServer().unregisterMBean( mbeanName );
+            }
+            catch( Exception e )
+            {
+                // ignore this, we can't do anything about it
+            }
+        }
     }
 }

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerImpl.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerImpl.java?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerImpl.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/log/LoggerImpl.java Thu Dec  4 12:46:24
2008
@@ -20,6 +20,8 @@
  */
 package com.ecyrd.jspwiki.log;
 
+import java.io.Serializable;
+
 import org.slf4j.Logger;
 
 /**
@@ -28,8 +30,9 @@
  * @author Harry Metske
  * @since 3.0
  */
-public class LoggerImpl implements com.ecyrd.jspwiki.log.Logger
+public class LoggerImpl implements com.ecyrd.jspwiki.log.Logger, Serializable
 {
+    private static final long serialVersionUID = 1L;
     Logger m_slf4jLogger = null;
     
     /**

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java?rev=723430&r1=723429&r2=723430&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java Thu Dec 
4 12:46:24 2008
@@ -113,12 +113,12 @@
                 if( !m_mbeanServer.isRegistered(name))
                 {
                     m_mbeanServer.registerMBean( ab, name );
+                    log.info("Registered new admin bean "+ab.getTitle());
                 }
             }
 
             m_allBeans.add( ab );
 
-            log.info("Registered new admin bean "+ab.getTitle());
         }
         catch( InstanceAlreadyExistsException e )
         {



Mime
View raw message