io.airlift.log.Logging类的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中io.airlift.log.Logging类的一些代码示例,展示了Logging类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logging类的具体详情如下:
包路径:io.airlift.log.Logging
类名称:Logging

Logging介绍

[英]Initializes the logging subsystem.

java.util.Logging, System.out and System.err are tunneled through the logging system.

System.out and System.err are assigned to loggers named "stdout" and "stderr", respectively.
[中]初始化日志子系统。
JAVAutil。日志记录,系统。外部和系统。err通过记录系统进行隧道传输。
系统外部和系统。err分别分配给名为“stdout”和“stderr”的记录器。

代码示例

代码示例来源:origin: prestodb/presto

public static void main(String[] args)
    throws Exception
{
  Logging.initialize();
  Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080");
  ThriftQueryRunnerWithServers queryRunner = (ThriftQueryRunnerWithServers) createThriftQueryRunner(3, 3, true, properties);
  Thread.sleep(10);
  Logger log = Logger.get(ThriftQueryRunner.class);
  log.info("======== SERVER STARTED ========");
  log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}

代码示例来源:origin: prestodb/presto

Logging logging = Logging.initialize();
logging.configure(config);

代码示例来源:origin: prestodb/presto

@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 new UncheckedIOException(e);
    }
    finally {
      System.setOut(out);
      System.setErr(err);
    }
  }
}

代码示例来源:origin: prestosql/presto

public static void main(String[] args)
      throws Exception
  {
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Thread.sleep(10);
    Logger log = Logger.get(BlackHoleQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
  }
}

代码示例来源:origin: airlift/airlift

logging = Logging.initialize();
Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> log.error(throwable, "Uncaught exception in thread %s", thread.getName()));
if (requiredConfigurationProperties == null) {
  log.info("Loading configuration");
  log.info("Initializing logging");
  LoggingConfiguration configuration = configurationFactory.build(LoggingConfiguration.class);
  logging.configure(configuration);

代码示例来源:origin: airlift/airlift

@Test
  public void testChildLevelOverridesParent()
      throws Exception
  {
    Logging logging = Logging.initialize();
    Logger logger = Logger.get("testChildLevelOverridesParent.child");

    logging.setLevel("testChildLevelOverridesParent", Level.DEBUG);
    logging.setLevel("testChildLevelOverridesParent.child", Level.ERROR);
    assertFalse(logger.isDebugEnabled());
    assertFalse(logger.isInfoEnabled());
  }
}

代码示例来源:origin: prestodb/presto

@BeforeClass
public void setupClass()
{
  Logging.initialize();
  if (PARALLEL) {
    executor = listeningDecorator(newFixedThreadPool(getRuntime().availableProcessors() * 2, daemonThreadsNamed("completer-%s")));
  }
  else {
    executor = newDirectExecutorService();
  }
  functionAssertions = new FunctionAssertions();
}

代码示例来源:origin: prestodb/presto

@BeforeClass
public void setupServer()
    throws Exception
{
  Logging.initialize();
  server = new TestingPrestoServer();
  server.installPlugin(new HiveHadoop2Plugin());
  server.createCatalog("hive", "hive-hadoop2", ImmutableMap.<String, String>builder()
      .put("hive.metastore", "file")
      .put("hive.metastore.catalog.dir", server.getBaseDataDir().resolve("hive").toAbsolutePath().toString())
      .put("hive.security", "sql-standard")
      .build());
  try (Connection connection = createConnection();
      Statement statement = connection.createStatement()) {
    statement.execute("CREATE SCHEMA default");
    statement.execute("CREATE SCHEMA fruit");
  }
}

代码示例来源:origin: prestodb/presto

Files.write(sharedSecretFile, sharedSecret);
Logging.initialize();
server = new TestingPrestoServer();
server.installPlugin(new TpchPlugin());
server.createCatalog("tpch", "tpch");
server.installPlugin(new BlackHolePlugin());
server.createCatalog("blackhole", "blackhole");

代码示例来源:origin: airlift/airship

public static void initializeLogging(boolean debug)
      throws IOException
  {
    // 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());
      }
      else {
        System.setOut(new PrintStream(nullOutputStream()));
        System.setErr(new PrintStream(nullOutputStream()));

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

代码示例来源:origin: prestodb/presto

@BeforeClass
public void setupServer()
    throws Exception
{
  Logging.initialize();
  server = new TestingPrestoServer();
}

代码示例来源:origin: prestosql/presto

private static void setupLogging()
{
  Logging logging = Logging.initialize();
  logging.setLevel("org.apache.parquet.hadoop", WARN);
}

代码示例来源:origin: com.teradata.airlift/log-manager

public void setRootLevel(Level newLevel)
{
  setLevel(ROOT_LOGGER_NAME, newLevel);
}

代码示例来源:origin: airlift/airlift

public void configure(LoggingConfiguration config)
      throws IOException
  {
    if (config.getLogPath() != null) {
      logToFile(config.getLogPath(), config.getMaxHistory(), config.getMaxSize().toBytes());
    }

    if (!config.isConsoleEnabled()) {
      disableConsole();
    }

    if (config.getLevelsFile() != null) {
      setLevels(new File(config.getLevelsFile()));
    }
  }
}

代码示例来源:origin: io.prestosql/presto-tpcds

public static void main(String[] args)
      throws Exception
  {
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Thread.sleep(10);
    Logger log = Logger.get(TpcdsQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
  }
}

代码示例来源:origin: com.teradata.airlift/bootstrap

logging = Logging.initialize();
Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> log.error(throwable, "Uncaught exception in thread %s", thread.getName()));
if (requiredConfigurationProperties == null) {
  log.info("Loading configuration");
  ConfigurationLoader loader = new ConfigurationLoader();
  log.info("Initializing logging");
  LoggingConfiguration configuration = configurationFactory.build(LoggingConfiguration.class);
  logging.configure(configuration);

代码示例来源:origin: com.teradata.airlift/log-manager

@Test
  public void testChildLevelOverridesParent()
      throws Exception
  {
    Logging logging = Logging.initialize();
    Logger logger = Logger.get("testChildLevelOverridesParent.child");

    logging.setLevel("testChildLevelOverridesParent", Level.DEBUG);
    logging.setLevel("testChildLevelOverridesParent.child", Level.ERROR);
    assertFalse(logger.isDebugEnabled());
    assertFalse(logger.isInfoEnabled());
  }
}

代码示例来源:origin: airlift/airlift

@Provides
  @Singleton
  public Logging getLogging()
  {
    return Logging.initialize();
  }
}

代码示例来源:origin: prestodb/presto

@BeforeClass
public void setup()
    throws Exception
{
  Logging.initialize();
  server = new TestingPrestoServer();
  server.installPlugin(new BlackHolePlugin());
  server.createCatalog("blackhole", "blackhole");
  waitForNodeRefresh(server);
  try (Connection connection = createConnection();
      Statement statement = connection.createStatement()) {
    statement.executeUpdate("CREATE SCHEMA blackhole.blackhole");
  }
}

代码示例来源:origin: io.airlift.airship/airship-cli

public static void initializeLogging(boolean debug)
      throws IOException
  {
    // 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());
        // TODO: add public level interface to logging framework
        new LoggingMBean().setLevel("io.airlift.airship", "DEBUG");
      }
      else {
        System.setOut(new PrintStream(nullOutputStream()));
        System.setErr(new PrintStream(nullOutputStream()));

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

相关文章