Skip to content

Commit

Permalink
fix:Illegal logger method invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
JinQian1024 committed Sep 6, 2024
1 parent 5cf4290 commit b56af45
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import org.apache.dubbo.qos.api.CommandContext;
import org.apache.dubbo.rpc.model.ApplicationModel;

import static org.apache.dubbo.common.constants.LoggerCodeConstants.QOS_UNEXPECTED_EXCEPTION;
import java.util.Arrays;

public class ActuatorCommandExecutor implements ActuatorExecutor {
private static final Logger log = LoggerFactory.getLogger(ActuatorCommandExecutor.class);
private static final Logger logger = LoggerFactory.getLogger(ActuatorCommandExecutor.class);
private final ApplicationModel applicationModel;

public ActuatorCommandExecutor(ApplicationModel applicationModel) {
Expand All @@ -43,20 +43,21 @@ public String execute(String commandName, String[] parameters) {
commandContext = CommandContextFactory.newInstance(commandName, parameters, true);
}

logger.info("[Dubbo Actuator QoS] Command Process start. Command: " + commandContext.getCommandName()
+ ", Args: " + Arrays.toString(commandContext.getArgs()));

BaseCommand command;
try {
command = applicationModel
.getExtensionLoader(BaseCommand.class)
.getExtension(commandContext.getCommandName());
return command.execute(commandContext, commandContext.getArgs());
} catch (Exception qosEx) {
log.error(
QOS_UNEXPECTED_EXCEPTION,
"",
"",
"execute commandContext: " + commandContext + " got exception",
qosEx);
return qosEx.getMessage();
} catch (Throwable t) {
logger.info(
"[Dubbo Actuator QoS] Command Process Failed. Command: " + commandContext.getCommandName()
+ ", Args: " + Arrays.toString(commandContext.getArgs()),
t);
throw t;
}
}
}

0 comments on commit b56af45

Please sign in to comment.