Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: migrate to log4j-core #3326

Merged
merged 8 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bigtable-hbase-1.x-parent/bigtable-hbase-1.x-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.log4j.BasicConfigurator;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
import org.apache.logging.log4j.core.config.builder.api.RootLoggerComponentBuilder;
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -538,7 +543,19 @@ private static void usage(final String errorMsg) {

public static void main(String[] args) throws IOException, DeserializationException {
// Configure the logger.
BasicConfigurator.configure();
ConfigurationBuilder<BuiltConfiguration> builder =
ConfigurationBuilderFactory.newConfigurationBuilder();
RootLoggerComponentBuilder rootLoggerBuilder = builder.newRootLogger(Level.INFO);
builder.add(rootLoggerBuilder);

// Uncomment the following line to get detailed logs on Schema Translator

// LoggerComponentBuilder schemaTranslatorLogs =
// builder.newLogger("com.google.cloud.bigtable.hbase.tools.HBaseSchemaTranslator",
// Level.TRACE);
// builder.add(schemaTranslatorLogs);

Configurator.initialize(builder.build());

SchemaTranslationOptions options = SchemaTranslationOptions.loadOptionsFromSystemProperties();
HBaseSchemaTranslator translator = new HBaseSchemaTranslator(options);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<Configuration>
<Loggers>
<Root level="INFO"/>
<!-- Uncomment the following line to get detailed logs on Schema Translator-->
<!-- <Logger name="com.google.cloud.bigtable.hbase.tools.HBaseSchemaTranslator" level="TRACE"/>-->
</Loggers>
</Configuration>