Browse Source

remove String.format for org.slf4j.Logger (#2001)

pull/2/head
gabry.wu 5 years ago committed by GitHub
parent
commit
5ca4862ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
  2. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
  3. 2
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java
  4. 2
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PlaceholderUtils.java
  5. 2
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
  6. 2
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/threadutils/ThreadPoolExecutorsTest.java
  7. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerThread.java
  8. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
  9. 12
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
  10. 4
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
  11. 4
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskQueueZkImpl.java

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java

@ -242,7 +242,7 @@ public class ExecutorService extends BaseService{
}
break;
default:
logger.error(String.format("unknown execute type : %s", executeType.toString()));
logger.error("unknown execute type : {}", executeType);
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type");
break;

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java

@ -547,7 +547,7 @@ public class ResourcesService extends BaseService {
}
} catch (Exception e) {
logger.error(String.format("Resource %s read failed", hdfsFileName), e);
logger.error("Resource {} read failed", hdfsFileName, e);
putMsg(result, Status.HDFS_OPERATION_ERROR);
}

2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java

@ -61,7 +61,7 @@ public class ParameterUtils {
try {
cronTime = DateUtils.parseDate(cronTimeStr, new String[]{Constants.PARAMETER_FORMAT_TIME});
} catch (ParseException e) {
logger.error(String.format("parse %s exception", cronTimeStr), e);
logger.error("parse {} exception", cronTimeStr, e);
}
} else {
cronTime = new Date();

2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PlaceholderUtils.java

@ -90,7 +90,7 @@ public class PlaceholderUtils {
try {
return paramsMap.get(placeholderName);
} catch (Exception ex) {
logger.error(String.format("resolve placeholder '%s' in [ %s ]" , placeholderName, value), ex);
logger.error("resolve placeholder '{}' in [ {} ]" , placeholderName, value, ex);
return null;
}
}

2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java

@ -278,7 +278,7 @@ public class TimePlaceholderUtils {
try {
return calculateTime(placeholderName, date);
} catch (Exception ex) {
logger.error(String.format("resolve placeholder '%s' in [ %s ]" , placeholderName, value), ex);
logger.error("resolve placeholder '{}' in [ {} ]" , placeholderName, value, ex);
return null;
}
}

2
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/threadutils/ThreadPoolExecutorsTest.java

@ -48,7 +48,7 @@ public class ThreadPoolExecutorsTest {
class Thread2 extends Thread {
@Override
public void run() {
logger.info(String.format("ThreadPoolExecutors instance's hashcode is: %s ",ThreadPoolExecutors.getInstance("a",2).hashCode()));
logger.info("ThreadPoolExecutors instance's hashcode is: {} ",ThreadPoolExecutors.getInstance("a",2).hashCode());
}
}

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerThread.java

@ -117,7 +117,7 @@ public class MasterSchedulerThread implements Runnable {
// make sure to scan and delete command table in one transaction
Command command = processService.findOneCommand();
if (command != null) {
logger.info(String.format("find one command: id: %d, type: %s", command.getId(),command.getCommandType().toString()));
logger.info("find one command: id: {}, type: {}", command.getId(),command.getCommandType());
try{
processInstance = processService.handleCommand(logger, OSUtils.getHost(), this.masterExecThreadNum - activeCount, command);

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

@ -176,7 +176,7 @@ public abstract class AbstractCommandExecutor {
} catch (InterruptedException e) {
exitStatusCode = -1;
logger.error(String.format("interrupt exception: {}, task may be cancelled or killed",e.getMessage()), e);
logger.error("interrupt exception: {}, task may be cancelled or killed", e.getMessage(), e);
throw new RuntimeException("interrupt exception. exitCode is : " + exitStatusCode);
} catch (Exception e) {
exitStatusCode = -1;
@ -408,7 +408,7 @@ public abstract class AbstractCommandExecutor {
}
}
} catch (Exception e) {
logger.error(String.format("yarn applications: %s status failed ", appIds.toString()),e);
logger.error("yarn applications: {} status failed ", appIds,e);
result = false;
}
return result;
@ -458,7 +458,7 @@ public abstract class AbstractCommandExecutor {
lineList.add(line);
}
} catch (Exception e) {
logger.error(String.format("read file: %s failed : ",filename),e);
logger.error("read file: {} failed",filename,e);
} finally {
if(br != null){
try {

12
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

@ -477,7 +477,7 @@ public class ProcessService {
if(cmdParam == null
|| !cmdParam.containsKey(Constants.CMDPARAM_START_NODE_NAMES)
|| cmdParam.get(Constants.CMDPARAM_START_NODE_NAMES).isEmpty()){
logger.error(String.format("command node depend type is %s, but start nodes is null ", command.getTaskDependType().toString()));
logger.error("command node depend type is {}, but start nodes is null ", command.getTaskDependType());
return false;
}
}
@ -500,7 +500,7 @@ public class ProcessService {
if(command.getProcessDefinitionId() != 0){
processDefinition = processDefineMapper.selectById(command.getProcessDefinitionId());
if(processDefinition == null){
logger.error(String.format("cannot find the work process define! define id : %d", command.getProcessDefinitionId()));
logger.error("cannot find the work process define! define id : {}", command.getProcessDefinitionId());
return null;
}
}
@ -973,21 +973,21 @@ public class ProcessService {
return true;
}
if(taskInstance.getState().typeIsFinished()){
logger.info(String.format("submit to task queue, but task [%s] state [%s] is already finished. ", taskInstance.getName(), taskInstance.getState().toString()));
logger.info("submit to task queue, but task [{}] state [{}] is already finished. ", taskInstance.getName(), taskInstance.getState());
return true;
}
// task cannot submit when running
if(taskInstance.getState() == ExecutionStatus.RUNNING_EXEUTION){
logger.info(String.format("submit to task queue, but task [%s] state already be running. ", taskInstance.getName()));
logger.info("submit to task queue, but task [{}] state already be running. ", taskInstance.getName());
return true;
}
if(checkTaskExistsInTaskQueue(taskInstance)){
logger.info(String.format("submit to task queue, but task [%s] already exists in the queue.", taskInstance.getName()));
logger.info("submit to task queue, but task [{}] already exists in the queue.", taskInstance.getName());
return true;
}
logger.info("task ready to queue: {}" , taskInstance);
boolean insertQueueResult = taskQueue.add(DOLPHINSCHEDULER_TASKS_QUEUE, taskZkInfo(taskInstance));
logger.info(String.format("master insert into queue success, task : %s", taskInstance.getName()) );
logger.info("master insert into queue success, task : {}", taskInstance.getName());
return insertQueueResult;
}catch (Exception e){
logger.error("submit task to queue Exception: ", e);

4
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java

@ -223,7 +223,7 @@ public class QuartzExecutors {
}
} catch (SchedulerException e) {
logger.error(String.format("delete job : %s failed",jobName), e);
logger.error("delete job : {} failed",jobName, e);
} finally {
lock.writeLock().unlock();
}
@ -247,7 +247,7 @@ public class QuartzExecutors {
return scheduler.deleteJobs(jobKeys);
} catch (SchedulerException e) {
logger.error(String.format("delete all jobs in job group: %s failed",jobGroupName), e);
logger.error("delete all jobs in job group: {} failed",jobGroupName, e);
} finally {
lock.writeLock().unlock();
}

4
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/TaskQueueZkImpl.java

@ -269,7 +269,7 @@ public class TaskQueueZkImpl implements ITaskQueue {
zookeeperOperator.remove(taskIdPath);
}catch(Exception e){
logger.error(String.format("delete task:%s from zookeeper fail, exception:" ,nodeValue) ,e);
logger.error("delete task:{} from zookeeper fail, exception:" ,nodeValue ,e);
}
}
@ -318,7 +318,7 @@ public class TaskQueueZkImpl implements ITaskQueue {
zookeeperOperator.remove(path + value);
}catch(Exception e){
logger.error(String.format("delete task:" + value + " exception"),e);
logger.error("delete task:{} exception",value,e);
}
}

Loading…
Cancel
Save