Search in sources :

Example 1 with LoggingConfiguration

use of io.airlift.log.LoggingConfiguration in project presto by prestodb.

the class PrestoBenchmarkDriver method initializeLogging.

@SuppressWarnings("UseOfSystemOutOrSystemErr")
public static void initializeLogging(boolean debug) {
    // unhook out and err while initializing logging or logger will print to them
    PrintStream out = System.out;
    PrintStream err = System.err;
    try {
        if (debug) {
            Logging logging = Logging.initialize();
            logging.configure(new LoggingConfiguration());
            logging.setLevel("com.facebook.presto", Level.DEBUG);
        } else {
            System.setOut(new PrintStream(nullOutputStream()));
            System.setErr(new PrintStream(nullOutputStream()));
            Logging logging = Logging.initialize();
            logging.configure(new LoggingConfiguration());
            logging.disableConsole();
        }
    } catch (IOException e) {
        throw Throwables.propagate(e);
    } finally {
        System.setOut(out);
        System.setErr(err);
    }
}
Also used : Logging(io.airlift.log.Logging) PrintStream(java.io.PrintStream) LoggingConfiguration(io.airlift.log.LoggingConfiguration) IOException(java.io.IOException)

Example 2 with LoggingConfiguration

use of io.airlift.log.LoggingConfiguration in project presto by prestodb.

the class Console method initializeLogging.

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);
    } catch (IOException e) {
        throw Throwables.propagate(e);
    } finally {
        System.setOut(out);
        System.setErr(err);
    }
}
Also used : Logging(io.airlift.log.Logging) PrintStream(java.io.PrintStream) LoggingConfiguration(io.airlift.log.LoggingConfiguration) IOException(java.io.IOException)

Example 3 with LoggingConfiguration

use of io.airlift.log.LoggingConfiguration in project presto by prestodb.

the class PerfTest method initializeLogging.

private static void initializeLogging(boolean debug) {
    // unhook out and err while initializing logging or logger will print to them
    PrintStream out = System.out;
    PrintStream err = System.err;
    try {
        if (debug) {
            Logging logging = Logging.initialize();
            logging.configure(new LoggingConfiguration());
            logging.setLevel("com.facebook.presto", Level.DEBUG);
        } else {
            System.setOut(new PrintStream(nullOutputStream()));
            System.setErr(new PrintStream(nullOutputStream()));
            Logging logging = Logging.initialize();
            logging.configure(new LoggingConfiguration());
            logging.disableConsole();
        }
    } catch (IOException e) {
        throw Throwables.propagate(e);
    } finally {
        System.setOut(out);
        System.setErr(err);
    }
}
Also used : Logging(io.airlift.log.Logging) PrintStream(java.io.PrintStream) LoggingConfiguration(io.airlift.log.LoggingConfiguration) IOException(java.io.IOException)

Aggregations

Logging (io.airlift.log.Logging)3 LoggingConfiguration (io.airlift.log.LoggingConfiguration)3 IOException (java.io.IOException)3 PrintStream (java.io.PrintStream)3