Skip to content

Commit

Permalink
Remove log levels option from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Jun 22, 2021
1 parent c1b3a9e commit dabd7fe
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 41 deletions.
5 changes: 0 additions & 5 deletions client/trino-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
<artifactId>log</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>log-manager</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>units</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ public class ClientOptions
@Option(names = "--progress", paramLabel = "<progress>", description = "Show query progress in batch mode")
public boolean progress;

@Option(names = "--log-levels-file", paramLabel = "<file>", description = "Configure log levels for debugging using this file")
public String logLevelsFile;

@Option(names = "--execute", paramLabel = "<execute>", description = "Execute specified statements and exit")
public String execute;

Expand Down
33 changes: 0 additions & 33 deletions client/trino-cli/src/main/java/io/trino/cli/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import com.google.common.base.CharMatcher;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.ByteStreams;
import io.airlift.log.Logging;
import io.airlift.log.LoggingConfiguration;
import io.airlift.units.Duration;
import io.trino.cli.ClientOptions.OutputFormat;
import io.trino.cli.Trino.VersionProvider;
Expand Down Expand Up @@ -54,7 +52,6 @@
import static com.google.common.base.StandardSystemProperty.USER_HOME;
import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.base.Strings.nullToEmpty;
import static com.google.common.io.ByteStreams.nullOutputStream;
import static com.google.common.io.Files.asCharSource;
import static com.google.common.util.concurrent.Uninterruptibles.awaitUninterruptibly;
import static io.trino.cli.Completion.commandCompleter;
Expand Down Expand Up @@ -111,8 +108,6 @@ public boolean run()
boolean hasQuery = clientOptions.execute != null;
boolean isFromFile = !isNullOrEmpty(clientOptions.file);

initializeLogging(clientOptions.logLevelsFile);

String query = clientOptions.execute;
if (hasQuery) {
query += ";";
Expand Down Expand Up @@ -437,32 +432,4 @@ private static Path getHistoryFile()
}
return Paths.get(nullToEmpty(USER_HOME.value()), ".trino_history");
}

private static void initializeLogging(String logLevelsFile)
{
// unhook out and err while initializing logging or logger will print to them
PrintStream out = System.out;
PrintStream err = System.err;

try {
LoggingConfiguration config = new LoggingConfiguration();

if (logLevelsFile == null) {
System.setOut(new PrintStream(nullOutputStream()));
System.setErr(new PrintStream(nullOutputStream()));

config.setConsoleEnabled(false);
}
else {
config.setLevelsFile(logLevelsFile);
}

Logging logging = Logging.initialize();
logging.configure(config);
}
finally {
System.setOut(out);
System.setErr(err);
}
}
}

0 comments on commit dabd7fe

Please sign in to comment.