Browse Source

ds.server & ds.common.zk regularize log print (#1754)

pull/2/head
Yelli 5 years ago committed by Tboy
parent
commit
963ed4a8c6
  1. 22
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java
  2. 4
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  3. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
  4. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
  5. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKWorkerClient.java
  6. 2
      dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/EnvFileTest.java

22
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java

@ -16,18 +16,6 @@
*/
package org.apache.dolphinscheduler.common.zk;
import static org.apache.dolphinscheduler.common.Constants.ADD_ZK_OP;
import static org.apache.dolphinscheduler.common.Constants.DELETE_ZK_OP;
import static org.apache.dolphinscheduler.common.Constants.MASTER_PREFIX;
import static org.apache.dolphinscheduler.common.Constants.SINGLE_SLASH;
import static org.apache.dolphinscheduler.common.Constants.UNDERLINE;
import static org.apache.dolphinscheduler.common.Constants.WORKER_PREFIX;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.imps.CuratorFrameworkState;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
@ -42,6 +30,8 @@ import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import static org.apache.dolphinscheduler.common.Constants.*;
/**
* abstract zookeeper client
@ -84,7 +74,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator{
zkClient.setData().forPath(znode,str.getBytes());
} catch (Exception e) {
logger.error("heartbeat for zk failed : " + e.getMessage(), e);
logger.error("heartbeat for zk failed", e);
stoppable.stop("heartbeat for zk exception, release resources and stop myself");
}
}
@ -274,7 +264,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator{
masterMap.putIfAbsent(server, super.get(path + "/" + server));
}
} catch (Exception e) {
logger.error("get server list failed : " + e.getMessage(), e);
logger.error("get server list failed", e);
}
return masterMap;
@ -406,7 +396,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator{
if(e.getMessage().equals("instance must be started before calling this method")){
logger.warn("lock release");
}else{
logger.error("lock release failed : " + e.getMessage(),e);
logger.error("lock release failed",e);
}
}
@ -423,7 +413,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator{
persist(getDeadZNodeParentPath(), "");
} catch (Exception e) {
logger.error("init system znode failed : " + e.getMessage(),e);
logger.error("init system znode failed",e);
}
}

4
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -211,7 +211,7 @@ public class WorkerServer implements IStoppable {
//thread sleep 3 seconds for thread quitely stop
Thread.sleep(3000L);
}catch (Exception e){
logger.warn("thread sleep exception:" + e.getMessage(), e);
logger.warn("thread sleep exception", e);
}
try {
@ -252,7 +252,7 @@ public class WorkerServer implements IStoppable {
logger.info("zookeeper service stopped");
} catch (Exception e) {
logger.error("worker server stop exception : " + e.getMessage(), e);
logger.error("worker server stop exception ", e);
System.exit(-1);
}
}

6
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java

@ -292,7 +292,7 @@ public abstract class AbstractCommandExecutor {
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.info("kill attempt failed." + e.getMessage(), e);
logger.info("kill attempt failed", e);
}
}
@ -312,7 +312,7 @@ public abstract class AbstractCommandExecutor {
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.error("kill attempt failed." + e.getMessage(), e);
logger.error("kill attempt failed ", e);
}
}
}
@ -407,7 +407,7 @@ public abstract class AbstractCommandExecutor {
}
}
} catch (Exception e) {
logger.error(String.format("yarn applications: %s status failed : " + e.getMessage(), appIds.toString()),e);
logger.error(String.format("yarn applications: %s status failed ", appIds.toString()),e);
result = false;
}
return result;

6
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java

@ -107,7 +107,7 @@ public class ZKMasterClient extends AbstractZKClient {
}
}catch (Exception e){
logger.error("master start up exception : " + e.getMessage(),e);
logger.error("master start up exception",e);
}finally {
releaseMutex(mutex);
}
@ -143,7 +143,7 @@ public class ZKMasterClient extends AbstractZKClient {
}
masterZNode = serverPath;
} catch (Exception e) {
logger.error("register master failure : " + e.getMessage(),e);
logger.error("register master failure ",e);
System.exit(-1);
}
}
@ -192,7 +192,7 @@ public class ZKMasterClient extends AbstractZKClient {
}
}catch (Exception e){
logger.error("{} server failover failed.", zkNodeType.toString());
logger.error("failover exception : " + e.getMessage(),e);
logger.error("failover exception ",e);
}
finally {
releaseMutex(mutex);

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKWorkerClient.java

@ -69,7 +69,7 @@ public class ZKWorkerClient extends AbstractZKClient {
}
workerZNode = serverPath;
} catch (Exception e) {
logger.error("register worker failure : " + e.getMessage(),e);
logger.error("register worker failure",e);
System.exit(-1);
}
}

2
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/EnvFileTest.java

@ -65,7 +65,7 @@ public class EnvFileTest {
}
}catch (IOException e){
logger.error("read file failed : " + e.getMessage(),e);
logger.error("read file failed",e);
}finally {
try {
if (br != null){

Loading…
Cancel
Save