logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1158546 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: LogFilePatternLayoutBuilder.java LogUI.java vfs/VFSLogFilePatternReceiver.java
Date Wed, 17 Aug 2011 07:13:43 GMT
Author: sdeboy
Date: Wed Aug 17 07:13:43 2011
New Revision: 1158546

URL: http://svn.apache.org/viewvc?rev=1158546&view=rev
Log:
Fix case sensitivity in configuration parsing
Fix VFS tailing, particularly with sftp (the filesystem needed to be closed)

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java?rev=1158546&r1=1158545&r2=1158546&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
Wed Aug 17 07:13:43 2011
@@ -32,6 +32,7 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.log4j.chainsaw.messages.MessageCenter;
 import org.apache.log4j.helpers.OptionConverter;
 import org.apache.log4j.pattern.ClassNamePatternConverter;
 import org.apache.log4j.pattern.DatePatternConverter;
@@ -255,14 +256,14 @@ public class LogFilePatternLayoutBuilder
               Node appenderChild = appenderChildren.item(j);
               if (appenderChild.getNodeName().equals("param") && appenderChild.hasAttributes())
{
                 Node fileNameNode = appenderChild.getAttributes().getNamedItem("name");
-                if (fileNameNode != null && fileNameNode.getNodeValue().equals("file"))
{
+                if (fileNameNode != null && fileNameNode.getNodeValue().toLowerCase().equals("file"))
{
                   Node fileValueNode = appenderChild.getAttributes().getNamedItem("value");
                   if (fileValueNode != null) {
                     entry.put("file", fileValueNode.getNodeValue());
                   }
                 }
               }
-              if (appenderChild.getNodeName().equals("layout") && appenderChild.hasAttributes())
{
+              if (appenderChild.getNodeName().toLowerCase().equals("layout") && appenderChild.hasAttributes())
{
                 NamedNodeMap layoutAttributes = appenderChild.getAttributes();
                 Node layoutNode = layoutAttributes.getNamedItem("class");
                 if (layoutNode != null && layoutNode.getNodeValue() != null &&
layoutNode.getNodeValue().equals("org.apache.log4j.PatternLayout")) {
@@ -271,7 +272,7 @@ public class LogFilePatternLayoutBuilder
                     Node layoutChild = layoutChildren.item(k);
                     if (layoutChild.getNodeName().equals("param") && layoutChild.hasAttributes())
{
                       Node layoutName = layoutChild.getAttributes().getNamedItem("name");
-                      if (layoutName != null && layoutName.getNodeValue() != null
&& layoutName.getNodeValue().equals("ConversionPattern")) {
+                      if (layoutName != null && layoutName.getNodeValue() != null
&& layoutName.getNodeValue().toLowerCase().equals("conversionpattern")) {
                         Node conversionValue = layoutChild.getAttributes().getNamedItem("value");
                         if (conversionValue != null) {
                           entry.put("conversion", conversionValue.getNodeValue());
@@ -289,6 +290,7 @@ public class LogFilePatternLayoutBuilder
     } finally {
       stream.close();
     }
+    MessageCenter.getInstance().getLogger().info("getXMLFileAppenderConfiguration for file:
" + file + ", result: " + result);
     return result;
   }
 }

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=1158546&r1=1158545&r2=1158546&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 Wed Aug 17 07:13:43
2011
@@ -1427,7 +1427,7 @@ public class LogUI extends JFrame implem
   }
 
   /**
-   * Displays a dialog which will provide options for selecting a configuratino
+   * Displays a dialog which will provide options for selecting a configuration
    */
   private void showReceiverConfigurationPanel() {
     SwingUtilities.invokeLater(

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java?rev=1158546&r1=1158545&r2=1158546&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
Wed Aug 17 07:13:43 2011
@@ -314,9 +314,8 @@ public class VFSLogFilePatternReceiver e
           }
           vfsReader = new VFSReader();
           new Thread(vfsReader).start();
-        }
+        } else if (oldURL != null && oldURL.indexOf("://") > -1) {
         //starts with protocol://
-        if (oldURL != null && oldURL.indexOf("://") > -1) {
             int index = oldURL.indexOf("://");
             String lastPart = oldURL.substring(index + "://".length());
             int passEndIndex = lastPart.indexOf("@");
@@ -403,6 +402,7 @@ public class VFSLogFilePatternReceiver e
 
                         //fileobject was created above, release it and construct a new one
                         if (fileObject != null) {
+                            fileObject.getFileSystem().getFileSystemManager().closeFileSystem(fileObject.getFileSystem());
                             fileObject.close();
                             fileObject = null;
                         }
@@ -435,15 +435,6 @@ public class VFSLogFilePatternReceiver e
                                 rac.close();
                             }
                             try {
-                                //release file so it can be externally deleted/renamed if
necessary
-                                fileObject.close();
-                                fileObject = null;
-                            }
-                            catch (IOException e)
-                            {
-                                getLogger().debug(getPath() + " - unable to close fileobject",
e);
-                            }
-                            try {
                                 if (reader != null) {
                                     reader.close();
                                     reader = null;



Mime
View raw message