未验证 提交 5ca4862e 编写于 作者: G gabry.wu 提交者: GitHub

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

上级 205b3026
...@@ -242,7 +242,7 @@ public class ExecutorService extends BaseService{ ...@@ -242,7 +242,7 @@ public class ExecutorService extends BaseService{
} }
break; break;
default: 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"); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type");
break; break;
......
...@@ -547,7 +547,7 @@ public class ResourcesService extends BaseService { ...@@ -547,7 +547,7 @@ public class ResourcesService extends BaseService {
} }
} catch (Exception e) { } 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); putMsg(result, Status.HDFS_OPERATION_ERROR);
} }
......
...@@ -61,7 +61,7 @@ public class ParameterUtils { ...@@ -61,7 +61,7 @@ public class ParameterUtils {
try { try {
cronTime = DateUtils.parseDate(cronTimeStr, new String[]{Constants.PARAMETER_FORMAT_TIME}); cronTime = DateUtils.parseDate(cronTimeStr, new String[]{Constants.PARAMETER_FORMAT_TIME});
} catch (ParseException e) { } catch (ParseException e) {
logger.error(String.format("parse %s exception", cronTimeStr), e); logger.error("parse {} exception", cronTimeStr, e);
} }
} else { } else {
cronTime = new Date(); cronTime = new Date();
......
...@@ -90,7 +90,7 @@ public class PlaceholderUtils { ...@@ -90,7 +90,7 @@ public class PlaceholderUtils {
try { try {
return paramsMap.get(placeholderName); return paramsMap.get(placeholderName);
} catch (Exception ex) { } 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; return null;
} }
} }
......
...@@ -278,7 +278,7 @@ public class TimePlaceholderUtils { ...@@ -278,7 +278,7 @@ public class TimePlaceholderUtils {
try { try {
return calculateTime(placeholderName, date); return calculateTime(placeholderName, date);
} catch (Exception ex) { } 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; return null;
} }
} }
......
...@@ -48,7 +48,7 @@ public class ThreadPoolExecutorsTest { ...@@ -48,7 +48,7 @@ public class ThreadPoolExecutorsTest {
class Thread2 extends Thread { class Thread2 extends Thread {
@Override @Override
public void run() { 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());
} }
} }
......
...@@ -117,7 +117,7 @@ public class MasterSchedulerThread implements Runnable { ...@@ -117,7 +117,7 @@ public class MasterSchedulerThread implements Runnable {
// make sure to scan and delete command table in one transaction // make sure to scan and delete command table in one transaction
Command command = processService.findOneCommand(); Command command = processService.findOneCommand();
if (command != null) { 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{ try{
processInstance = processService.handleCommand(logger, OSUtils.getHost(), this.masterExecThreadNum - activeCount, command); processInstance = processService.handleCommand(logger, OSUtils.getHost(), this.masterExecThreadNum - activeCount, command);
......
...@@ -176,7 +176,7 @@ public abstract class AbstractCommandExecutor { ...@@ -176,7 +176,7 @@ public abstract class AbstractCommandExecutor {
} catch (InterruptedException e) { } catch (InterruptedException e) {
exitStatusCode = -1; 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); throw new RuntimeException("interrupt exception. exitCode is : " + exitStatusCode);
} catch (Exception e) { } catch (Exception e) {
exitStatusCode = -1; exitStatusCode = -1;
...@@ -408,7 +408,7 @@ public abstract class AbstractCommandExecutor { ...@@ -408,7 +408,7 @@ public abstract class AbstractCommandExecutor {
} }
} }
} catch (Exception e) { } 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; result = false;
} }
return result; return result;
...@@ -458,7 +458,7 @@ public abstract class AbstractCommandExecutor { ...@@ -458,7 +458,7 @@ public abstract class AbstractCommandExecutor {
lineList.add(line); lineList.add(line);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error(String.format("read file: %s failed : ",filename),e); logger.error("read file: {} failed",filename,e);
} finally { } finally {
if(br != null){ if(br != null){
try { try {
......
...@@ -477,7 +477,7 @@ public class ProcessService { ...@@ -477,7 +477,7 @@ public class ProcessService {
if(cmdParam == null if(cmdParam == null
|| !cmdParam.containsKey(Constants.CMDPARAM_START_NODE_NAMES) || !cmdParam.containsKey(Constants.CMDPARAM_START_NODE_NAMES)
|| cmdParam.get(Constants.CMDPARAM_START_NODE_NAMES).isEmpty()){ || 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; return false;
} }
} }
...@@ -500,7 +500,7 @@ public class ProcessService { ...@@ -500,7 +500,7 @@ public class ProcessService {
if(command.getProcessDefinitionId() != 0){ if(command.getProcessDefinitionId() != 0){
processDefinition = processDefineMapper.selectById(command.getProcessDefinitionId()); processDefinition = processDefineMapper.selectById(command.getProcessDefinitionId());
if(processDefinition == null){ 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; return null;
} }
} }
...@@ -973,21 +973,21 @@ public class ProcessService { ...@@ -973,21 +973,21 @@ public class ProcessService {
return true; return true;
} }
if(taskInstance.getState().typeIsFinished()){ 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; return true;
} }
// task cannot submit when running // task cannot submit when running
if(taskInstance.getState() == ExecutionStatus.RUNNING_EXEUTION){ 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; return true;
} }
if(checkTaskExistsInTaskQueue(taskInstance)){ 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; return true;
} }
logger.info("task ready to queue: {}" , taskInstance); logger.info("task ready to queue: {}" , taskInstance);
boolean insertQueueResult = taskQueue.add(DOLPHINSCHEDULER_TASKS_QUEUE, taskZkInfo(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; return insertQueueResult;
}catch (Exception e){ }catch (Exception e){
logger.error("submit task to queue Exception: ", e); logger.error("submit task to queue Exception: ", e);
......
...@@ -223,7 +223,7 @@ public class QuartzExecutors { ...@@ -223,7 +223,7 @@ public class QuartzExecutors {
} }
} catch (SchedulerException e) { } catch (SchedulerException e) {
logger.error(String.format("delete job : %s failed",jobName), e); logger.error("delete job : {} failed",jobName, e);
} finally { } finally {
lock.writeLock().unlock(); lock.writeLock().unlock();
} }
...@@ -247,7 +247,7 @@ public class QuartzExecutors { ...@@ -247,7 +247,7 @@ public class QuartzExecutors {
return scheduler.deleteJobs(jobKeys); return scheduler.deleteJobs(jobKeys);
} catch (SchedulerException e) { } 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 { } finally {
lock.writeLock().unlock(); lock.writeLock().unlock();
} }
......
...@@ -269,7 +269,7 @@ public class TaskQueueZkImpl implements ITaskQueue { ...@@ -269,7 +269,7 @@ public class TaskQueueZkImpl implements ITaskQueue {
zookeeperOperator.remove(taskIdPath); zookeeperOperator.remove(taskIdPath);
}catch(Exception e){ }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 { ...@@ -318,7 +318,7 @@ public class TaskQueueZkImpl implements ITaskQueue {
zookeeperOperator.remove(path + value); zookeeperOperator.remove(path + value);
}catch(Exception e){ }catch(Exception e){
logger.error(String.format("delete task:" + value + " exception"),e); logger.error("delete task:{} exception",value,e);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册