jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r1556332 - in /jspwiki/trunk: ./ jspwiki-war/src/main/java/org/apache/wiki/ jspwiki-war/src/main/java/org/apache/wiki/util/ jspwiki-war/src/main/resources/ini/
Date Tue, 07 Jan 2014 19:51:37 GMT
Author: metskem
Date: Tue Jan  7 19:51:36 2014
New Revision: 1556332

URL: http://svn.apache.org/r1556332
Log:
2014-01-07  Harry Metske (metskem@apache.org)

       * 2.10.0-svn-67

       * PropertyReader now using log4j, offer a way to use an external log4j.properties or
log4j.xml file.

Modified:
    jspwiki/trunk/ChangeLog
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/PropertyReader.java
    jspwiki/trunk/jspwiki-war/src/main/resources/ini/jspwiki.properties

Modified: jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/jspwiki/trunk/ChangeLog?rev=1556332&r1=1556331&r2=1556332&view=diff
==============================================================================
--- jspwiki/trunk/ChangeLog (original)
+++ jspwiki/trunk/ChangeLog Tue Jan  7 19:51:36 2014
@@ -1,5 +1,15 @@
 2014-01-07  Harry Metske (metskem@apache.org)
 
+       * 2.10.0-svn-67
+
+       * PropertyReader was using context.log for its logging. Every user changing his prefs
is causing
+         6 lines of logging to stdout which is cumbersome to get rid of. Changing this to
log4j logging
+         and offering a way to use an external log4j.properties file so PropertyReader can
use log4j
+         right away. (The cascaded property reading mechanism does not support "suppressing"
properties
+         from the ini/jspwiki.properties, only overriding)
+
+2014-01-07  Harry Metske (metskem@apache.org)
+
        * 2.10.0-svn-66
 
        * JSPWIKI-810 - included the ReferringUndefinedPagesPlugin

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java?rev=1556332&r1=1556331&r2=1556332&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java Tue Jan  7 19:51:36
2014
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "66";
+    public static final String     BUILD         = "67";
     
     /**
      *  This is the generic version string you should use when printing out the version.
 It is of 

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java?rev=1556332&r1=1556331&r2=1556332&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java Tue Jan  7 19:51:36
2014
@@ -451,15 +451,15 @@ public class WikiEngine
         m_properties = props;
 
         //
-        //  Initialized log4j.  However, make sure that
-        //  we don't initialize it multiple times.  Also, if
-        //  all of the log4j statements have been removed from
-        //  the property file, we do not do any property setting
-        //  either.q
+        //  Initialize log4j.  However, make sure that we don't initialize it multiple times.
+        //  By default we load the log4j config statements from jspwiki.properties, unless
+        //  the property jspwiki.use.external.logconfig=true, in that case we let log4j figure
out the
+        //  logging configuration.
         //
         if( !c_configured )
         {
-            if( props.getProperty("log4j.rootCategory") != null )
+            String useExternalLogConfig = props.getProperty("jspwiki.use.external.logconfig");
+            if( useExternalLogConfig == null || useExternalLogConfig.equals("false"))
             {
                 PropertyConfigurator.configure( props );
             }

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/PropertyReader.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/PropertyReader.java?rev=1556332&r1=1556331&r2=1556332&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/PropertyReader.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/PropertyReader.java Tue Jan
 7 19:51:36 2014
@@ -119,24 +119,24 @@ public final class PropertyReader {
             //  Figure out where our properties lie.
             //
             if( propertyFile == null ) {
-                context.log( "No " + PARAM_CUSTOMCONFIG + " defined for this context, " +
+                LOG.info( "No " + PARAM_CUSTOMCONFIG + " defined for this context, " +
                              "looking for custom properties file with default name of: "
+ CUSTOM_JSPWIKI_CONFIG );
                 //  Use the custom property file at the default location
                 propertyStream = PropertyReader.class.getResourceAsStream( CUSTOM_JSPWIKI_CONFIG
);
             } else {
-                context.log(PARAM_CUSTOMCONFIG + " defined, using " + propertyFile + " as
the custom properties file.");
+                LOG.info(PARAM_CUSTOMCONFIG + " defined, using " + propertyFile + " as the
custom properties file.");
                 propertyStream = new FileInputStream( new File(propertyFile) );
             }
 
             Properties props = getDefaultProperties();
             if( propertyStream == null ) {
-                context.log("No custom property file found, relying on JSPWiki defaults.");
+                LOG.info("No custom property file found, relying on JSPWiki defaults.");
             } else {
                 props.load( propertyStream );
             }
 
             //this will add additional properties to the default ones:
-            context.log( "Loading cascading properties..." );
+            LOG.debug( "Loading cascading properties..." );
 
             //now load the cascade (new in 2.5)
             loadWebAppPropsCascade( context, props );
@@ -146,7 +146,7 @@ public final class PropertyReader {
 
             return props;
         } catch( Exception e ) {
-            context.log( Release.APPNAME + ": Unable to load and setup properties from jspwiki.properties.
" + 
+            LOG.error( Release.APPNAME + ": Unable to load and setup properties from jspwiki.properties.
" +
                          e.getMessage() );
         } finally {
         	IOUtils.closeQuietly( propertyStream );
@@ -227,7 +227,7 @@ public final class PropertyReader {
      */
     private static void loadWebAppPropsCascade( ServletContext context, Properties defaultProperties
) {
         if( getInitParameter( context, PARAM_CUSTOMCONFIG_CASCADEPREFIX + "1" ) == null )
{
-            context.log( " No cascading properties defined for this context" );
+            LOG.debug( " No cascading properties defined for this context" );
             return;
         }
 
@@ -245,13 +245,13 @@ public final class PropertyReader {
             }
 
             try {
-                context.log( " Reading additional properties from " + propertyFile + " and
merge to cascade." );
+                LOG.info( " Reading additional properties from " + propertyFile + " and merge
to cascade." );
                 Properties additionalProps = new Properties();
                 propertyStream = new FileInputStream( new File( propertyFile ) );
                 additionalProps.load(propertyStream);
                 defaultProperties.putAll(additionalProps);
             } catch( Exception e ) {
-                context.log( " " + Release.APPNAME +
+                LOG.error( " " + Release.APPNAME +
                              ": Unable to load and setup properties from " + propertyFile
+ "." +
                              e.getMessage() );
             } finally {

Modified: jspwiki/trunk/jspwiki-war/src/main/resources/ini/jspwiki.properties
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/resources/ini/jspwiki.properties?rev=1556332&r1=1556331&r2=1556332&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/resources/ini/jspwiki.properties (original)
+++ jspwiki/trunk/jspwiki-war/src/main/resources/ini/jspwiki.properties Tue Jan  7 19:51:36
2014
@@ -829,6 +829,11 @@ mail.smtp.port = 25
 #  Configure logs.  See log4j documentation for more information
 #  on how you can configure the logs.
 #
+#  By default we load the log4j config statements from this file (see below), unless
+#  the property jspwiki.use.external.logconfig=true, in that case we let log4j figure out
the
+#  logging configuration to use.
+#
+jspwiki.use.external.logconfig = false
 #  Log4j is available at http://log4j.apache.org
 #
 #  WARNING WARNING WILL ROBINSON: If you turn on DEBUG logging, be aware



Mime
View raw message