Jelajahi Sumber

fix ugly logger usage (#2063)

* fix ugly logger usage

* remove space
qiaozhanwei 5 tahun lalu
induk
melakukan
d5c795bd45

+ 2 - 2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java

@@ -103,7 +103,7 @@ public class DataAnalysisController extends BaseController{
                                             @RequestParam(value="endDate", required=false) String endDate,
                                             @RequestParam(value="projectId", required=false, defaultValue = "0") int projectId){
         try{
-            logger.info("count process instance state, user:{}, start date: {}, end date:{}, project id",
+            logger.info("count process instance state, user:{}, start date: {}, end date:{}, project id:{}",
                     loginUser.getUserName(), startDate, endDate, projectId);
             Map<String, Object> result = dataAnalysisService.countProcessInstanceStateByProject(loginUser, projectId, startDate, endDate);
             return returnDataList(result);
@@ -129,7 +129,7 @@ public class DataAnalysisController extends BaseController{
     public Result countDefinitionByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                                         @RequestParam(value="projectId", required=false, defaultValue = "0") int projectId){
         try{
-            logger.info("count process definition , user:{}, project id",
+            logger.info("count process definition , user:{}, project id:{}",
                     loginUser.getUserName(), projectId);
             Map<String, Object> result = dataAnalysisService.countDefinitionByUser(loginUser, projectId);
             return returnDataList(result);

+ 1 - 1
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java

@@ -173,7 +173,7 @@ public class ExecutorController extends BaseController {
     @ResponseStatus(HttpStatus.OK)
     public Result startCheckProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                              @RequestParam(value = "processDefinitionId") int processDefinitionId) {
-        logger.info("login user {}, check process definition", loginUser.getUserName(), processDefinitionId);
+        logger.info("login user {}, check process definition {}", loginUser.getUserName(), processDefinitionId);
         try {
             Map<String, Object> result = execService.startCheckByProcessDefinedId(processDefinitionId);
             return returnDataList(result);

+ 1 - 1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java

@@ -145,7 +145,7 @@ public class NettyRemotingServer {
         try {
             future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
         } catch (Exception e) {
-            logger.error("NettyRemotingServer bind fail {}, exit", e);
+            logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
             throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
         }
         if (future.isSuccess()) {

+ 1 - 1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyClientHandler.java

@@ -107,7 +107,7 @@ public class NettyClientHandler extends ChannelInboundHandlerAdapter {
      */
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
-        logger.error("exceptionCaught : {}", cause);
+        logger.error("exceptionCaught : {}",cause.getMessage(), cause);
         nettyRemotingClient.closeChannel(ChannelUtils.toAddress(ctx.channel()));
         ctx.channel().close();
     }

+ 1 - 1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyServerHandler.java

@@ -140,7 +140,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
      */
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
-        logger.error("exceptionCaught : {}", cause);
+        logger.error("exceptionCaught : {}",cause.getMessage(), cause);
         ctx.channel().close();
     }
 

+ 1 - 1
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java

@@ -565,7 +565,7 @@ public class MasterExecThread implements Runnable {
 
         TaskInstance taskInstance = completeTaskList.get(nodeName);
         if(taskInstance == null){
-            logger.error("task instance cannot find, please check it!", nodeName);
+            logger.error("task instance {} cannot find, please check it!", nodeName);
             return conditionTaskList;
         }
 

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

@@ -116,12 +116,12 @@ public class ProcessService {
         ProcessInstance processInstance = constructProcessInstance(command, host);
         //cannot construct process instance, return null;
         if(processInstance == null){
-            logger.error("scan command, command parameter is error: %s", command.toString());
+            logger.error("scan command, command parameter is error: {}", command);
             moveToErrorCommand(command, "process instance is null");
             return null;
         }
         if(!checkThreadNum(command, validThreadNum)){
-            logger.info("there is not enough thread for this command: {}",command.toString() );
+            logger.info("there is not enough thread for this command: {}", command);
             return setWaitingThreadProcess(command, processInstance);
         }
         processInstance.setCommandType(command.getCommandType());
@@ -991,7 +991,7 @@ public class ProcessService {
             return insertQueueResult;
         }catch (Exception e){
             logger.error("submit task to queue Exception: ", e);
-            logger.error("task queue error : %s", JSONUtils.toJson(taskInstance));
+            logger.error("task queue error : {}", JSONUtils.toJson(taskInstance));
             return false;
         }
     }