Skip to content

Commit

Permalink
[Fix](trino-connector) Disable JUL from printing logs to the console (a…
Browse files Browse the repository at this point in the history
…pache#33178)

Disable JUL from printing logs to the console, otherwise these logs will be printed to be.out
  • Loading branch information
BePPPower authored Apr 3, 2024
1 parent 8d9e12a commit 4c1599f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.apache.logging.log4j.Logger;

import java.io.File;
import java.util.Arrays;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.SimpleFormatter;
Expand All @@ -50,12 +52,14 @@ private static class TrinoConnectorPluginLoad {
"%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s: %5$s%6$s%n");
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("");
logger.setUseParentHandlers(false);
Arrays.stream(logger.getHandlers())
.filter(handler -> handler instanceof ConsoleHandler)
.forEach(handler -> handler.setLevel(Level.OFF));
FileHandler fileHandler = new FileHandler(EnvUtils.getDorisHome() + "/log/trinoconnector%g.log",
500000000, 10, true);
fileHandler.setLevel(Level.INFO);
fileHandler.setFormatter(new SimpleFormatter());
logger.addHandler(fileHandler);
java.util.logging.LogManager.getLogManager().addLogger(logger);

TypeOperators typeOperators = new TypeOperators();
featuresConfig = new FeaturesConfig();
Expand Down

0 comments on commit 4c1599f

Please sign in to comment.