Logger cleanup

This commit is contained in:
Philipp Dallig 2021-09-08 13:19:07 +02:00
parent b180bfc7bf
commit 72e7c010f8
6 changed files with 33 additions and 31 deletions

View file

@ -61,7 +61,7 @@ public class BeelineInPlaceUpdateStream implements InPlaceUpdateStream {
GetOperationStatus
*/
lastUpdateTimestamp = System.currentTimeMillis();
LOGGER.info("update progress: " + response.getProgressedPercentage());
LOGGER.info("update progress: {}", response.getProgressedPercentage());
inPlaceUpdate.render(new ProgressMonitorWrapper(response));
}
}

View file

@ -152,8 +152,10 @@ public class PythonInterpreter extends Interpreter {
if (usePy4jAuth) {
env.put("PY4J_GATEWAY_SECRET", secret);
}
LOGGER.info("Launching Python Process Command: " + cmd.getExecutable() +
" " + StringUtils.join(cmd.getArguments(), " "));
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Launching Python Process Command: {} {}",
cmd.getExecutable(), StringUtils.join(cmd.getArguments(), " "));
}
pythonProcessLauncher = new PythonProcessLauncher(cmd, env);
pythonProcessLauncher.launch();
@ -184,7 +186,7 @@ public class PythonInterpreter extends Interpreter {
}
this.pythonWorkDir = Files.createTempDirectory("python").toFile();
this.pythonWorkDir.deleteOnExit();
LOGGER.info("Create Python working dir: " + pythonWorkDir.getAbsolutePath());
LOGGER.info("Create Python working dir: {}", pythonWorkDir.getAbsolutePath());
copyResourceToPythonWorkDir("python/zeppelin_python.py", "zeppelin_python.py");
copyResourceToPythonWorkDir("python/zeppelin_context.py", "zeppelin_context.py");
copyResourceToPythonWorkDir("python/backend_zinline.py", "backend_zinline.py");
@ -217,7 +219,7 @@ public class PythonInterpreter extends Interpreter {
if (useBuiltinPy4j) {
appendToPythonPath(env, pythonWorkDir.getAbsolutePath() + "/py4j-src-0.10.7.zip");
}
LOGGER.info("PYTHONPATH: " + env.get("PYTHONPATH"));
LOGGER.info("PYTHONPATH: {}", env.get("PYTHONPATH"));
return env;
}
@ -253,11 +255,9 @@ public class PythonInterpreter extends Interpreter {
iPythonInterpreter.close();
return;
}
if (pythonProcessLauncher != null) {
if (pythonProcessLauncher.isRunning()) {
LOGGER.info("Kill python process");
pythonProcessLauncher.stop();
}
if (pythonProcessLauncher != null && pythonProcessLauncher.isRunning()) {
LOGGER.info("Kill python process");
pythonProcessLauncher.stop();
}
if (gatewayServer != null) {
gatewayServer.shutdown();
@ -265,13 +265,13 @@ public class PythonInterpreter extends Interpreter {
// reset these 2 monitors otherwise when you restart PythonInterpreter it would fails to execute
// python code as these 2 objects are in incorrect state.
statementSetNotifier = new Integer(0);
statementFinishedNotifier = new Integer(0);
statementSetNotifier = Integer.valueOf(0);
statementFinishedNotifier = Integer.valueOf(0);
}
private PythonInterpretRequest pythonInterpretRequest = null;
private Integer statementSetNotifier = new Integer(0);
private Integer statementFinishedNotifier = new Integer(0);
private Integer statementSetNotifier = Integer.valueOf(0);
private Integer statementFinishedNotifier = Integer.valueOf(0);
private String statementOutput = null;
private boolean statementError = false;
@ -330,7 +330,7 @@ public class PythonInterpreter extends Interpreter {
// called by Python Process
public void setStatementsFinished(String out, boolean error) {
synchronized (statementFinishedNotifier) {
LOGGER.debug("Setting python statement output: " + out + ", error: " + error);
LOGGER.debug("Setting python statement output: {}, error: {}", out, error);
statementOutput = out;
statementError = error;
statementFinishedNotifier.notify();
@ -348,7 +348,7 @@ public class PythonInterpreter extends Interpreter {
// called by Python Process
public void appendOutput(String message) throws IOException {
LOGGER.debug("Output from python process: " + message);
LOGGER.debug("Output from python process: {}", message);
outputStream.getInterpreterOutput().write(message);
}
@ -412,7 +412,7 @@ public class PythonInterpreter extends Interpreter {
public void interrupt() throws IOException, InterpreterException {
if (pythonPid > -1) {
LOGGER.info("Sending SIGINT signal to PID : " + pythonPid);
LOGGER.info("Sending SIGINT signal to PID : {}", pythonPid);
Runtime.getRuntime().exec("kill -SIGINT " + pythonPid);
} else {
LOGGER.warn("Non UNIX/Linux system, close the interpreter");
@ -459,7 +459,7 @@ public class PythonInterpreter extends Interpreter {
}
String completionString = getCompletionTargetString(buf, cursor);
String completionCommand = "__zeppelin_completion__.getCompletion('" + completionString + "')";
LOGGER.debug("completionCommand: " + completionCommand);
LOGGER.debug("completionCommand: {}", completionCommand);
pythonInterpretRequest = new PythonInterpretRequest(completionCommand, true);
statementOutput = null;
@ -559,7 +559,7 @@ public class PythonInterpreter extends Interpreter {
}
protected void bootstrapInterpreter(String resourceName) throws IOException {
LOGGER.info("Bootstrap interpreter via " + resourceName);
LOGGER.info("Bootstrap interpreter via {}", resourceName);
String bootstrapCode =
IOUtils.toString(getClass().getClassLoader().getResourceAsStream(resourceName));
try {
@ -588,7 +588,7 @@ public class PythonInterpreter extends Interpreter {
// Called by Python Process, used for debugging purpose
public void logPythonOutput(String message) {
LOGGER.debug("Python Process Output: " + message);
LOGGER.debug("Python Process Output: {}", message);
}
public class PythonProcessLauncher extends ProcessLauncher {

View file

@ -48,7 +48,7 @@ import static org.junit.Assert.assertTrue;
public class YarnInterpreterLauncherIntegrationTest {
private static Logger LOGGER = LoggerFactory.getLogger(YarnInterpreterLauncherIntegrationTest.class);
private static final Logger LOGGER = LoggerFactory.getLogger(YarnInterpreterLauncherIntegrationTest.class);
private static MiniHadoopCluster hadoopCluster;
private static MiniZeppelin zeppelin;

View file

@ -74,7 +74,7 @@ import java.util.zip.ZipOutputStream;
*/
public class YarnRemoteInterpreterProcess extends RemoteInterpreterProcess {
private static Logger LOGGER = LoggerFactory.getLogger(YarnRemoteInterpreterProcess.class);
private static final Logger LOGGER = LoggerFactory.getLogger(YarnRemoteInterpreterProcess.class);
private String host;
private int port = -1;
@ -122,14 +122,14 @@ public class YarnRemoteInterpreterProcess extends RemoteInterpreterProcess {
LOGGER.info("Adding resource: {}", coreSite.getAbsolutePath());
this.hadoopConf.addResource(coreSite.toURI().toURL());
} catch (MalformedURLException e) {
LOGGER.warn("Fail to add core-site.xml: " + coreSite.getAbsolutePath(), e);
LOGGER.warn("Fail to add core-site.xml: {}", coreSite.getAbsolutePath(), e);
}
File yarnSite = new File(hadoopConfDir, "yarn-site.xml");
try {
LOGGER.info("Adding resource: {}", yarnSite.getAbsolutePath());
this.hadoopConf.addResource(yarnSite.toURI().toURL());
} catch (MalformedURLException e) {
LOGGER.warn("Fail to add yarn-site.xml: " + yarnSite.getAbsolutePath(), e);
LOGGER.warn("Fail to add yarn-site.xml: {}", yarnSite.getAbsolutePath(), e);
}
} else {
throw new RuntimeException("HADOOP_CONF_DIR: " + hadoopConfDir.getAbsolutePath() +
@ -375,7 +375,9 @@ public class YarnRemoteInterpreterProcess extends RemoteInterpreterProcess {
List<String> yarnClassPath = Arrays.asList(getYarnAppClasspath());
List<String> mrClassPath = Arrays.asList(getMRAppClasspath());
yarnClassPath.addAll(mrClassPath);
LOGGER.info("Adding hadoop classpath: {}", StringUtils.join(yarnClassPath, ":"));
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Adding hadoop classpath: {}", String.join(":", yarnClassPath));
}
for (String path : yarnClassPath) {
String newValue = path;
if (envs.containsKey(ApplicationConstants.Environment.CLASSPATH.name())) {
@ -570,7 +572,7 @@ public class YarnRemoteInterpreterProcess extends RemoteInterpreterProcess {
FileSystem srcFs = srcPath.getFileSystem(hadoopConf);
Path destPath = new Path(destDir, srcPath.getName());
LOGGER.info("Uploading resource " + srcPath + " to " + destPath);
LOGGER.info("Uploading resource {} to {}", srcPath, destPath);
FileUtil.copy(srcFs, srcPath, destFs, destPath, false, hadoopConf);
destFs.setReplication(destPath, replication);
destFs.setPermission(destPath, APP_FILE_PERMISSION);

View file

@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
@Path("/admin")
@Singleton
public class AdminRestApi {
private static final Logger logger = LoggerFactory.getLogger(AdminRestApi.class);
private static final Logger LOGGER = LoggerFactory.getLogger(AdminRestApi.class);
private final AdminService adminService;
@ -56,7 +56,7 @@ public class AdminRestApi {
@GET
@ZeppelinApi
public List<org.apache.log4j.Logger> getLoggerSetting(@QueryParam("name") String name) {
logger.debug("name: {}", name);
LOGGER.debug("name: {}", name);
return null == name || name.isEmpty()
? adminService.getLoggers()
: Arrays.asList(adminService.getLogger(name));
@ -74,10 +74,10 @@ public class AdminRestApi {
if (null == loggerRequest
|| StringUtils.isEmpty(loggerRequest.getName())
|| StringUtils.isEmpty(loggerRequest.getLevel())) {
logger.trace("loggerRequest: {}", loggerRequest);
LOGGER.trace("loggerRequest: {}", loggerRequest);
throw new BadRequestException("Wrong request body");
}
logger.debug("loggerRequest: {}", loggerRequest);
LOGGER.debug("loggerRequest: {}", loggerRequest);
adminService.setLoggerLevel(loggerRequest);

View file

@ -52,7 +52,7 @@ public class HtmlAddonResource extends Resource {
private byte[] alteredContent;
public HtmlAddonResource(final Resource indexResource, final String bodyAddon, final String headAddon) {
LOGGER.info("Enabling html addons in " + indexResource + ": body='{}' head='{}'", bodyAddon, headAddon);
LOGGER.info("Enabling html addons in {}: body='{}' head='{}'", indexResource, bodyAddon, headAddon);
this.indexResource = indexResource;
try {
// read original content from resource