logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r946685 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/help/
Date Thu, 20 May 2010 16:15:37 GMT
Author: sdeboy
Date: Thu May 20 16:15:36 2010
New Revision: 946685

URL: http://svn.apache.org/viewvc?rev=946685&view=rev
Log:
Support use of 'log4j.configuration' system property to configure Chainsaw (only if the automatic
configuration URL is NOT specified in application-wide preferences).  The log4j.configuration
system property must provide the -URL- of the Chainsaw configuration file.
Also fixed a bug which prevented clearing of the automatic configuration URL field (the auto-config
field must be empty to use the log4j.configuration system property)

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
    logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java?rev=946685&r1=946684&r2=946685&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
Thu May 20 16:15:36 2010
@@ -404,11 +404,13 @@ public class ApplicationPreferenceModel 
      */
     public final void setConfigurationURL(String configurationURL)
     {
-        //don't add empty entries
+        //don't add empty entries, but allow the current configuration URL to be set to an
empty string
+        Object oldValue = this.configurationURL;
         if (configurationURL == null || configurationURL.trim().equals("")) {
+            this.configurationURL = "";
+            firePropertyChange("configurationURL", oldValue, this.configurationURL);
             return;
         }
-        Object oldValue = this.configurationURL;
         //add entry to MRU list
         if (!configurationURLs.contains(configurationURL)) {
           if (configurationURLs.size() == CONFIGURATION_URL_ENTRY_COUNT) {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java?rev=946685&r1=946684&r2=946685&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
Thu May 20 16:15:36 2010
@@ -539,7 +539,10 @@ public static void main(String[] args) {
         public boolean verify(JComponent input)
         {
             try {
-                new URL((String)configurationURL.getSelectedItem());
+                String selectedItem = (String)configurationURL.getSelectedItem();
+                if (selectedItem != null && !(selectedItem.trim().equals(""))) {
+                    new URL(selectedItem);
+                }
             } catch (Exception e) {
                 return false;
             }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=946685&r1=946684&r2=946685&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Thu May 20 16:15:36
2010
@@ -108,6 +108,7 @@ import org.apache.log4j.chainsaw.prefs.S
 import org.apache.log4j.chainsaw.prefs.SettingsListener;
 import org.apache.log4j.chainsaw.prefs.SettingsManager;
 import org.apache.log4j.chainsaw.receivers.ReceiversPanel;
+import org.apache.log4j.helpers.Constants;
 import org.apache.log4j.net.SocketNodeEventListener;
 import org.apache.log4j.plugins.Plugin;
 import org.apache.log4j.plugins.PluginEvent;
@@ -384,17 +385,23 @@ public class LogUI extends JFrame implem
     });
 
     String config = model.getConfigurationURL();
-    if(config!=null && (!(config.trim().equals("")))) {
-        config = config.trim();
-        try {
-          URL configURL = new URL(config);
-          logUI.loadConfigurationUsingPluginClassLoader(configURL);
-        }catch(MalformedURLException e) {
-            logger.error("Initial configuration - failed to convert config string to url",
e);
-        }
+    if (config == null || (config.trim().equals(""))) {
+        logger.info("No auto-configuration file found in ApplicationPreferenceModel - attempting
to use log4j.configurationURL system property");
+        config = System.getProperty(Constants.DEFAULT_CONFIGURATION_KEY);
     }
-    
-    //register a listener to load the configuration when it changes (avoid having to restart
Chainsaw when applying a new configuration)
+
+    if (config != null && (!config.trim().equals(""))) {
+      config = config.trim();
+      try {
+        URL configURL = new URL(config);
+        logger.info("Using '" + config + "' for auto-configuration");
+        logUI.loadConfigurationUsingPluginClassLoader(configURL);
+      } catch(MalformedURLException e) {
+        logger.error("Initial configuration - failed to convert config string to url", e);
+      }
+    }
+
+      //register a listener to load the configuration when it changes (avoid having to restart
Chainsaw when applying a new configuration)
     //this doesn't remove receivers from receivers panel, it just triggers DOMConfigurator.configure.
 	model.addPropertyChangeListener("configurationURL", new PropertyChangeListener() {
         public void propertyChange(PropertyChangeEvent evt) {
@@ -411,11 +418,6 @@ public class LogUI extends JFrame implem
             }
         }});
 
-    if (config == null || config.trim().equals("")) {
-      logger.info("No auto-configuration file found within the ApplicationPreferenceModel");
-    } else {
-      logger.info("Using '" + config + "' for auto-configuration");
-    }
     LogManager.getRootLogger().setLevel(Level.TRACE);
 
     logUI.activateViewer();

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html?rev=946685&r1=946684&r2=946685&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
Thu May 20 16:15:36 2010
@@ -10,6 +10,10 @@
 <b>NOTE:</b> The mechanism and format used to persist settings in Chainsaw is
subject to change.  If you are experiencing problems displaying events in Chainsaw, please
delete everything in the $user.dir/.chainsaw directory and restart Chainsaw.
 <br>
 <h1>2.0</h1>
+<h2>20 May 2010</h2>
+<ul>
+<li>For users who would like to specify the Chainsaw configuration file from the command
line, the 'log4j.configuration' system property will now be used if the automatic configuration
URL is NOT specified in application-wide preferences.  The log4j.configuration system property
must provide the -URL- of the Chainsaw configuration file.</li>
+</ul>
 <h2>13 May 2010</h2>
 <ul>
 <li>Added ability to quickly define color rules for field under mouse pointer in the
table as well as for the selected logger in the logger tree (uses default color chooser dialog).</li>
@@ -192,7 +196,6 @@ not to provide this, be on the look out 
 <ul>
 <li>Changed the default order of columns in Chainsaw to first display ID, level, logger,
message and exception</li>
 <li>Added default level expressions (example: LEVEL == DEBUG) to the 'refine focus'
combobox</li>
-<li>Modified Chainsaw initialization logic to load Chainsaw-specified config when specified.
 <b>NOTE:</b> Chainsaw will load configurations from BOTH the log4j.configuration
system property and Chainsaw's automatic configuration URL if the two are specified</li>
 <li>Corrected date pattern format bug (was displaying minutes where it should be displaying
months in the detail panel)</li>
 </ul>
 



Mime
View raw message