Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcheng15 committed Sep 26, 2022
1 parent 7ae07ac commit 786e93a
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
package streaming.common.zk;

import com.google.inject.Inject;
import net.csdn.common.logging.CSLogger;
import net.csdn.common.logging.Loggers;
import net.csdn.common.settings.Settings;
import org.I0Itec.zkclient.IZkDataListener;
import org.apache.log4j.Logger;

/**
* 7/7/16 WilliamZhu(allwefantasy@gmail.com)
*/
public class ZKClient {
private CSLogger logger = Loggers.getLogger(ZKClient.class);
private Logger logger = Logger.getLogger(ZKClient.class);
private ZKConfUtil zkConfUtil;

@Inject
Expand Down Expand Up @@ -171,7 +170,7 @@ public void main(String[] args) throws InterruptedException {
@Override
public void setConf(String conf) {
if (logger.isInfoEnabled()) {
logger.info("conf: {}", conf);
logger.info(String.format("conf: %s", conf));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void main(String[] args) throws InterruptedException {
String path = client.createEphemeralSequential(dir, null);

if (logger.isInfoEnabled()) {
logger.info("path: {}", path);
logger.info("Path: {}", path);
}

for (String l : client.getChildren(dir)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ class SparkRuntime(_params: JMap[Any, Any]) extends StreamingRuntime with Platfo
f.invoke(null, sparkSession.udf)
}
} catch {
case e: Exception =>
if (log.isDebugEnabled()) {
log.debug("RegisterUDF Error: {}", e)
}
case e: Exception => log.error("RegisterUDF Error: {}", e)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion streamingpro-core/src/main/java/tech/mlsql/app/App.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait RequestCleaner extends Logging {
try {
run()
} catch {
case e: Exception => log.debug("RequestCleaner Error: {}", e)
case e: Exception => log.error("RequestCleaner Error: {}", e)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package tech.mlsql.ets.hdfs;

import net.csdn.common.logging.CSLogger;
import net.csdn.common.logging.Loggers;
import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
Expand All @@ -31,7 +29,6 @@
import org.apache.hadoop.tools.TableListing;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.log4j.Logger;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand All @@ -45,7 +42,7 @@
*/
public class WowFsShell extends Configured implements Tool {

static final CSLogger logger = Loggers.getLogger(WowFsShell.class);
static final Log logger = LogFactory.getLog(WowFsShell.class);

private static final int MAX_LINE_WIDTH = 80;

Expand Down Expand Up @@ -350,7 +347,7 @@ public int run(String argv[]) throws Exception {
}
} catch (Exception e) {
// instance.run catches IOE, so something is REALLY wrong if here
logger.error("Run Error: \n cmd: {} \n Exception: {}", cmd, e);
logger.error(String.format("Run Error: \n cmd: %s \n Exception: %s", cmd, e));
displayError(cmd, "Fatal internal error");
}
}
Expand All @@ -360,7 +357,7 @@ public int run(String argv[]) throws Exception {
private void displayError(String cmd, String message) {
for (String line : message.split("\n")) {
error.println(cmd + ": " + line);
logger.error("{}: {}", cmd, line);
logger.error(cmd + ": " + line);
if (cmd.charAt(0) != '-') {
Command instance = null;
instance = commandFactory.getInstance("-" + cmd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ class NativeTest extends FunSuite with BeforeAndAfterAll with Logging {
assert("dj".equals(MLSQLNativeRuntime.funcLower("Dj")))
}

test("nativeGetCPULoad"){
if (log.isInfoEnabled()) {
log.info(MLSQLNativeRuntime.getCPULoad().toString());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package tech.mlsql.test
import org.apache.spark.streaming.BasicSparkOperation
import streaming.core.strategy.platform.SparkRuntime
import streaming.core.{BasicMLSQLConfig, SpecFunctions}
import tech.mlsql.common.utils.log.Logging

/**
* 10/11/2020 WilliamZhu(allwefantasy@gmail.com)
*/
class Test2 extends BasicSparkOperation with SpecFunctions with BasicMLSQLConfig with Logging{
class Test2 extends BasicSparkOperation with SpecFunctions with BasicMLSQLConfig {


"data-drive" should "framework" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ import tech.mlsql.common.utils.base.Templates
*/
class TemplateSpec extends BasicSparkOperation with SpecFunctions with BasicMLSQLConfig {
"named template" should "work" in {
println(Templates.evaluate(" hello {} ",Seq("jack")))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@

package streaming.core;

import net.csdn.common.logging.CSLogger;
import net.csdn.common.logging.Loggers;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.log4j.Logger;
import org.kamranzafar.jtar.TarOutputStream;

import javax.servlet.http.HttpServletResponse;
Expand All @@ -39,7 +38,7 @@
*/
public class DownloadRunner {

private static CSLogger logger = Loggers.getLogger(DownloadRunner.class);
private static Logger logger = Logger.getLogger(DownloadRunner.class);

public static int createTarFileStream(OutputStream output, String pathStr) {
String[] paths = pathStr.split(",");
Expand Down Expand Up @@ -90,7 +89,7 @@ public static int createTarFileStream(OutputStream output, String pathStr) {
} else return 400;

} catch (Exception e) {
logger.error("Error!!!\n pathStr: {} \n exception: {}", pathStr, e);
logger.error(String.format("Error!!!\n pathStr: %s \n exception: %s", pathStr, e));
return 500;

}
Expand All @@ -100,7 +99,7 @@ public static int getTarFileByPath(HttpServletResponse res, String pathStr) {
try {
return createTarFileStream(res.getOutputStream(), pathStr);
} catch (IOException e) {
logger.error("Error!!!\n res: {} \n pathStr: {} \n exception: {}", res, pathStr, e);
logger.error(String.format("Error!!!\n res: %s \n pathStr: %s \n exception: %s", res, pathStr, e));
return 500;
}
}
Expand Down Expand Up @@ -179,7 +178,7 @@ public static int getRawFileByPath(HttpServletResponse res, String path, long po


} catch (Exception e) {
logger.error("Error!!!\n res: {} \n path: {} \n position: {} \n exception: {}", res, path, position, e);
logger.error(String.format("Error!!!\n res: %s \n path: %s \n position: %s \n exception: %s", res, path, position, e));
}

return 500;
Expand Down

0 comments on commit 786e93a

Please sign in to comment.