Author: schultz
Date: Wed Jan 21 15:07:12 2015
New Revision: 1653550
URL: http://svn.apache.org/r1653550
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57473
Add more logging to WarWatcher, specifically checking for odd states like
non-existent files that were just listed by the filesystem, which suggests a
permissions problem.
Moved log strings into LocalStrings.properties
Modified:
tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java
Modified:
tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties?rev=1653550&r1=1653549&r2=1653550&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties Wed
Jan 21 15:07:12 2015
@@ -45,3 +45,9 @@ farmWarDeployer.stopped=Cluster FarmWarD
farmWarDeployer.undeployEnd=Undeployment from [{0}] finished.
farmWarDeployer.undeployLocal=Undeploy local context [{0}]
farmWarDeployer.watchDir=Cluster deployment is watching [{0}] for changes.
+
+warWatcher.checking-wars=Checking WARs in {0}
+warWatcher.listed-file-does-not-exist={0} was detected in {1} but does not
exist. Check directory permissions on {1}?
+warWatcher.checking-war=Checking WAR file {0}
+warWatcher.check-war.result=WarInfo.check() returned {0} for {1}
+warWatcher.cant-list-watchDir=Cannot list files in WatchDir "{0}": check to
see if it is a directory and has read permissions.
Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java?rev=1653550&r1=1653549&r2=1653550&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java Wed Jan 21
15:07:12 2015
@@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
/**
* The <b>WarWatcher </b> watches the deployDir for changes made to the
@@ -36,6 +37,8 @@ public class WarWatcher {
/*--Static Variables----------------------------------------*/
private static final Log log = LogFactory.getLog(WarWatcher.class);
+ private static final StringManager sm =
+ StringManager.getManager(Constants.Package);
/*--Instance Variables--------------------------------------*/
/**
@@ -67,20 +70,31 @@ public class WarWatcher {
*/
public void check() {
if (log.isDebugEnabled())
- log.debug("check cluster wars at " + watchDir);
+ log.debug(sm.getString("warWatcher.checking-wars", watchDir));
File[] list = watchDir.listFiles(new WarFilter());
- if (list == null)
+ if (list == null) {
+ log.warn(sm.getString("warWatcher.cant-list-watchDir",
+ watchDir));
+
list = new File[0];
+ }
//first make sure all the files are listed in our current status
for (int i = 0; i < list.length; i++) {
+ if(!list[i].exists())
+ log.warn(sm.getString("warWatcher.listed-file-does-not-exist",
+ list[i], watchDir));
+
addWarInfo(list[i]);
}
- //check all the status codes and update the FarmDeployer
+ // Check all the status codes and update the FarmDeployer
for (Iterator<Map.Entry<String,WarInfo>> i =
currentStatus.entrySet().iterator(); i.hasNext();) {
Map.Entry<String,WarInfo> entry = i.next();
WarInfo info = entry.getValue();
+ if(log.isTraceEnabled())
+ log.trace(sm.getString("warWatcher.checking-war",
+ info.getWar()));
int check = info.check();
if (check == 1) {
listener.fileModified(info.getWar());
@@ -89,6 +103,10 @@ public class WarWatcher {
//no need to keep in memory
i.remove();
}
+ if(log.isTraceEnabled())
+ log.trace(sm.getString("warWatcher.check-war.result",
+ Integer.valueOf(check),
+ info.getWar()));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]