io.airlift.log.Logger Java Examples
The following examples show how to use
io.airlift.log.Logger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccessControlModule.java From presto with Apache License 2.0 | 6 votes |
@Provides @Singleton public AccessControl createAccessControl(AccessControlManager accessControlManager) { Logger logger = Logger.get(AccessControl.class); AccessControl loggingInvocationsAccessControl = newProxy( AccessControl.class, new LoggingInvocationHandler( accessControlManager, new LoggingInvocationHandler.ReflectiveParameterNamesProvider(), logger::debug)); return ForwardingAccessControl.of(() -> { if (logger.isDebugEnabled()) { return loggingInvocationsAccessControl; } return accessControlManager; }); }
Example #2
Source File: PinotQueryRunner.java From presto with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080"); Map<String, String> pinotProperties = ImmutableMap.<String, String>builder() .put("pinot.controller-urls", "localhost:9000") .put("pinot.segments-per-split", "10") .put("pinot.request-timeout", "3m") .build(); DistributedQueryRunner queryRunner = createPinotQueryRunner(properties, pinotProperties); Thread.sleep(10); Logger log = Logger.get(PinotQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #3
Source File: PrestoProxy.java From presto with Apache License 2.0 | 6 votes |
public static void start(Module... extraModules) { Bootstrap app = new Bootstrap(ImmutableList.<Module>builder() .add(new NodeModule()) .add(new HttpServerModule()) .add(new JsonModule()) .add(new JaxrsModule()) .add(new MBeanModule()) .add(new JmxModule()) .add(new LogJmxModule()) .add(new TraceTokenModule()) .add(new EventModule()) .add(new ProxyModule()) .add(extraModules) .build()); Logger log = Logger.get(PrestoProxy.class); try { app.strictConfig().initialize(); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
Example #4
Source File: ElasticsearchQueryRunner.java From presto with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { // To start Elasticsearch: // docker run -p 9200:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.6.2 Logging.initialize(); DistributedQueryRunner queryRunner = createElasticsearchQueryRunner( HostAndPort.fromParts("localhost", 9200), TpchTable.getTables(), ImmutableMap.of("http-server.http.port", "8080"), ImmutableMap.of()); Logger log = Logger.get(ElasticsearchQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #5
Source File: PhoenixClientModule.java From presto with Apache License 2.0 | 6 votes |
@Provides @Singleton public JdbcClient createJdbcClientWithStats(PhoenixClient client) { StatisticsAwareJdbcClient statisticsAwareJdbcClient = new StatisticsAwareJdbcClient(client); Logger logger = Logger.get(format("io.prestosql.plugin.jdbc.%s.jdbcclient", catalogName)); JdbcClient loggingInvocationsJdbcClient = newProxy(JdbcClient.class, new LoggingInvocationHandler( statisticsAwareJdbcClient, new LoggingInvocationHandler.ReflectiveParameterNamesProvider(), logger::debug)); return ForwardingJdbcClient.of(() -> { if (logger.isDebugEnabled()) { return loggingInvocationsJdbcClient; } return statisticsAwareJdbcClient; }); }
Example #6
Source File: JdbcDiagnosticModule.java From presto with Apache License 2.0 | 6 votes |
@Provides @Singleton @StatsCollecting public JdbcClient createJdbcClientWithStats(@ForBaseJdbc JdbcClient client) { Logger logger = Logger.get(format("io.prestosql.plugin.jdbc.%s.jdbcclient", catalogName)); JdbcClient loggingInvocationsJdbcClient = newProxy(JdbcClient.class, new LoggingInvocationHandler( client, new ReflectiveParameterNamesProvider(), logger::debug)); return new StatisticsAwareJdbcClient(ForwardingJdbcClient.of(() -> { if (logger.isDebugEnabled()) { return loggingInvocationsJdbcClient; } return client; })); }
Example #7
Source File: SqlServerQueryRunner.java From presto with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); TestingSqlServer testingSqlServer = new TestingSqlServer(); testingSqlServer.start(); // SqlServer is using docker container so in case that shutdown hook is not called, developer can easily clean docker container on their own Runtime.getRuntime().addShutdownHook(new Thread(testingSqlServer::close)); DistributedQueryRunner queryRunner = (DistributedQueryRunner) createSqlServerQueryRunner( testingSqlServer, ImmutableMap.of(), ImmutableList.of()); Logger log = Logger.get(SqlServerQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #8
Source File: TpchQueryRunner.java From presto with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder() .setExtraProperties(ImmutableMap.<String, String>builder() .put("http-server.http.port", "8080") .put("sql.default-catalog", "tpch") .put("sql.default-schema", "tiny") .build()) .build(); Thread.sleep(10); Logger log = Logger.get(TpchQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #9
Source File: MemoryQueryRunner.java From presto with Apache License 2.0 | 5 votes |
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(MemoryQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #10
Source File: PrometheusQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createPrometheusQueryRunner(new PrometheusServer()); Thread.sleep(10); Logger log = Logger.get(PrometheusQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #11
Source File: OracleQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createOracleQueryRunner( new TestingOracleServer(), TpchTable.getTables()); Logger log = Logger.get(OracleQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #12
Source File: CassandraQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createCassandraQueryRunner( new CassandraServer(), ImmutableMap.of("http-server.http.port", "8080"), TpchTable.getTables()); Logger log = Logger.get(CassandraQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #13
Source File: GeoQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Logger log = Logger.get(GeoQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #14
Source File: BigQueryQueryRunner.java From presto with Apache License 2.0 | 5 votes |
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(BigQueryQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #15
Source File: ThriftQueryRunner.java From presto with Apache License 2.0 | 5 votes |
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, true, properties); Thread.sleep(10); Logger log = Logger.get(ThriftQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #16
Source File: BlackHoleQueryRunner.java From presto with Apache License 2.0 | 5 votes |
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()); }
Example #17
Source File: RaptorQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080"); DistributedQueryRunner queryRunner = createRaptorQueryRunner(properties, false, false); Thread.sleep(10); Logger log = Logger.get(RaptorQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #18
Source File: AccumuloModule.java From presto with Apache License 2.0 | 5 votes |
@Override public void configure(Binder binder) { // Add appender to Log4J root logger JulAppender appender = new JulAppender(); //create appender appender.setLayout(new PatternLayout("%d %-5p %c - %m%n")); appender.setThreshold(Level.INFO); appender.activateOptions(); org.apache.log4j.Logger.getRootLogger().addAppender(appender); binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(AccumuloConnector.class).in(Scopes.SINGLETON); binder.bind(AccumuloMetadata.class).in(Scopes.SINGLETON); binder.bind(AccumuloMetadataFactory.class).in(Scopes.SINGLETON); binder.bind(AccumuloClient.class).in(Scopes.SINGLETON); binder.bind(AccumuloSplitManager.class).in(Scopes.SINGLETON); binder.bind(AccumuloRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(AccumuloPageSinkProvider.class).in(Scopes.SINGLETON); binder.bind(AccumuloHandleResolver.class).in(Scopes.SINGLETON); binder.bind(AccumuloSessionProperties.class).in(Scopes.SINGLETON); binder.bind(AccumuloTableProperties.class).in(Scopes.SINGLETON); binder.bind(ZooKeeperMetadataManager.class).in(Scopes.SINGLETON); binder.bind(AccumuloTableManager.class).in(Scopes.SINGLETON); binder.bind(IndexLookup.class).in(Scopes.SINGLETON); binder.bind(ColumnCardinalityCache.class).in(Scopes.SINGLETON); binder.bind(Connector.class).toProvider(ConnectorProvider.class); configBinder(binder).bindConfig(AccumuloConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindMapJsonCodec(String.class, JsonCodec.listJsonCodec(AccumuloTable.class)); }
Example #19
Source File: MongoQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createMongoQueryRunner( new MongoServer(), ImmutableMap.of("http-server.http.port", "8080"), TpchTable.getTables()); Thread.sleep(10); Logger log = Logger.get(MongoQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #20
Source File: Server.java From presto with Apache License 2.0 | 5 votes |
private static void logLocation(Logger log, String name, Path path) { if (!Files.exists(path, NOFOLLOW_LINKS)) { log.info("%s: [does not exist]", name); return; } try { path = path.toAbsolutePath().toRealPath(); } catch (IOException e) { log.info("%s: [not accessible]", name); return; } log.info("%s: %s", name, path); }
Example #21
Source File: KafkaQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = builder(new TestingKafka()) .setTables(TpchTable.getTables()) .build(); Logger log = Logger.get(KafkaQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #22
Source File: ThriftTpchServer.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) { Logger log = Logger.get(ThriftTpchServer.class); try { start(ImmutableList.of()); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
Example #23
Source File: TestingPhoenixServer.java From presto with Apache License 2.0 | 5 votes |
private TestingPhoenixServer() { // keep references to prevent GC from resetting the log levels apacheLogger = java.util.logging.Logger.getLogger("org.apache"); apacheLogger.setLevel(Level.SEVERE); zookeeperLogger = java.util.logging.Logger.getLogger(ZooKeeperServer.class.getName()); zookeeperLogger.setLevel(Level.OFF); securityLogger = java.util.logging.Logger.getLogger("SecurityLogger.org.apache"); securityLogger.setLevel(Level.SEVERE); // to squelch the SecurityLogger, // instantiate logger with config above before config is overriden again in HBase test franework org.apache.commons.logging.LogFactory.getLog("SecurityLogger.org.apache.hadoop.hbase.server"); this.conf.set("hbase.security.logger", "ERROR"); this.conf.setInt(MASTER_INFO_PORT, -1); this.conf.setInt(REGIONSERVER_INFO_PORT, -1); this.conf.setInt(HBASE_CLIENT_RETRIES_NUMBER, 1); this.conf.setBoolean("phoenix.schema.isNamespaceMappingEnabled", true); this.conf.set("hbase.regionserver.wal.codec", "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec"); this.hbaseTestingUtility = new HBaseTestingUtility(conf); try { MiniZooKeeperCluster zkCluster = this.hbaseTestingUtility.startMiniZKCluster(); port = zkCluster.getClientPort(); MiniHBaseCluster hbaseCluster = hbaseTestingUtility.startMiniHBaseCluster(1, 4); hbaseCluster.waitForActiveAndReadyMaster(); LOG.info("Phoenix server ready: %s", getJdbcUrl()); } catch (Exception e) { throw new RuntimeException("Can't start phoenix server.", e); } }
Example #24
Source File: TpcdsQueryRunner.java From presto with Apache License 2.0 | 5 votes |
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()); }
Example #25
Source File: PostgreSqlQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createPostgreSqlQueryRunner( new TestingPostgreSqlServer(), ImmutableMap.of("http-server.http.port", "8080"), ImmutableMap.of(), TpchTable.getTables()); Logger log = Logger.get(PostgreSqlQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #26
Source File: AccumuloQueryRunner.java From presto with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createAccumuloQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(AccumuloQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Example #27
Source File: ManagedBackupStore.java From presto with Apache License 2.0 | 4 votes |
public ManagedBackupStore(BackupStore store) { this.store = requireNonNull(store, "store is null"); this.log = Logger.get(store.getClass()); }
Example #28
Source File: TestPrometheusIntegrationTests3.java From presto with Apache License 2.0 | 4 votes |
@Test public void testConfirmMetricAvailableAndCheckUp() throws Exception { final Integer maxTries = 60; final Integer timeBetweenTriesMillis = 1000; runner = createQueryRunner(); session = runner.getDefaultSession(); int tries = 0; final OkHttpClient httpClient = new OkHttpClient.Builder() .connectTimeout(120, TimeUnit.SECONDS) .readTimeout(120, TimeUnit.SECONDS) .build(); String prometheusServer = server.getAddress().toString(); HttpUrl.Builder urlBuilder = HttpUrl.parse("http://" + prometheusServer + "/api/v1/query").newBuilder(); urlBuilder.addQueryParameter("query", "up[1d]"); String url = urlBuilder.build().toString(); Request request = new Request.Builder() .url(url) .build(); String responseBody; // this seems to be a reliable way to ensure Prometheus has `up` metric data while (tries < maxTries) { responseBody = httpClient.newCall(request).execute().body().string(); if (responseBody.contains("values")) { Logger log = Logger.get(TestPrometheusIntegrationTests3.class); log.info("prometheus response: %s", responseBody); break; } Thread.sleep(timeBetweenTriesMillis); tries++; } if (tries == maxTries) { assertTrue(false, "Prometheus container not available for metrics query in " + maxTries * timeBetweenTriesMillis + " milliseconds."); } // now we're making sure the client is ready tries = 0; while (tries < maxTries) { if (session != null && runner.tableExists(session, "up")) { break; } Thread.sleep(timeBetweenTriesMillis); tries++; } if (tries == maxTries) { assertTrue(false, "Prometheus container, or client, not available for metrics query in " + maxTries * timeBetweenTriesMillis + " milliseconds."); } PrometheusTimeMachine.useFixedClockAt(LocalDateTime.now()); // must set time to now() as other tests may have set it MaterializedResult results = runner.execute(session, "SELECT * FROM prometheus.default.up LIMIT 1").toTestTypes(); assertEquals(results.getRowCount(), 1); MaterializedRow row = results.getMaterializedRows().get(0); assertEquals(row.getField(0).toString(), "{instance=localhost:9090, __name__=up, job=prometheus}"); }