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

log4j update to 2.17.1 #1865

Merged
merged 23 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
Next Next commit
WIP - update log4j
  • Loading branch information
mzagorskirs committed Feb 15, 2022
commit 7c0de2d0dc089161133282055fca9b85f9dc3fcf
4 changes: 2 additions & 2 deletions analytics/mapreduce/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
log4j.rootLogger=INFO, stdout

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout=org.apache.logging.log4j.core.appender.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout=org.apache.logging.log4j.core.layout.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
*/
package org.locationtech.geowave.core.cli.operations;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.PatternLayout;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.apache.logging.log4j.core.layout.PatternLayout.Builder;
import org.locationtech.geowave.core.cli.VersionUtils;
import org.locationtech.geowave.core.cli.annotations.GeowaveOperation;
import org.locationtech.geowave.core.cli.api.DefaultOperation;
Expand Down Expand Up @@ -45,9 +49,13 @@ public boolean prepare(final OperationParams inputParams) {

// Up the log level
if (Boolean.TRUE.equals(verboseFlag)) {
LogManager.getRootLogger().setLevel(Level.DEBUG);
LogManager.getRootLogger().addAppender(
new ConsoleAppender(new PatternLayout("%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n")));
Configurator.setRootLevel(Level.DEBUG);
PatternLayout patternLayout = PatternLayout.newBuilder().withPattern("%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n").build();
PatternLayout.createDefaultLayout();

ConsoleAppender consoleApp = ConsoleAppender.createDefaultAppenderForLayout(patternLayout);

((Logger) LogManager.getRootLogger()).addAppender(consoleApp);
}

// Print out the version info if requested.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArrayUtils;
import org.locationtech.geowave.core.index.IndexMetaData;
import org.locationtech.geowave.core.index.IndexUtils;
Expand All @@ -36,7 +37,7 @@
import org.locationtech.geowave.core.index.sfc.tiered.TieredSFCIndexStrategy;

public class BasicSFCIndexStrategy implements NumericIndexStrategy {
private static final Logger LOGGER = Logger.getLogger(BasicSFCIndexStrategy.class);
private static final Logger LOGGER = LogManager.getLogger(BasicSFCIndexStrategy.class);
private SpaceFillingCurve sfc;
private NumericDimensionDefinition[] baseDefinitions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArrayUtils;
import org.locationtech.geowave.core.index.IndexMetaData;
import org.locationtech.geowave.core.index.IndexUtils;
Expand All @@ -41,7 +42,7 @@
* encapsulated sub-strategy.
*/
public class SingleTierSubStrategy implements NumericIndexStrategy {
private static final Logger LOGGER = Logger.getLogger(SingleTierSubStrategy.class);
private static final Logger LOGGER = LogManager.getLogger(SingleTierSubStrategy.class);
private SpaceFillingCurve sfc;
private NumericDimensionDefinition[] baseDefinitions;
public byte tier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArrayRange;
import org.locationtech.geowave.core.index.ByteArrayUtils;
import org.locationtech.geowave.core.index.Coordinate;
Expand All @@ -39,7 +40,7 @@
* inserting ranges because there will be too much replication of data.
*/
public abstract class SimpleNumericIndexStrategy<T extends Number> implements NumericIndexStrategy {
private static final Logger LOGGER = Logger.getLogger(SimpleNumericIndexStrategy.class);
private static final Logger LOGGER = LogManager.getLogger(SimpleNumericIndexStrategy.class);

private final NumberLexicoder<T> lexicoder;
private final NumericDimensionDefinition[] definitions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions;
import org.locationtech.geowave.core.cli.parser.CommandLineOperationParams;
import org.locationtech.geowave.core.cli.parser.OperationParser;
Expand All @@ -36,7 +37,7 @@
import org.locationtech.geowave.mapreduce.output.GeoWaveOutputKey;

public class StoreCopyJobRunner extends Configured implements Tool {
private static final Logger LOGGER = Logger.getLogger(StoreCopyJobRunner.class);
private static final Logger LOGGER = LogManager.getLogger(StoreCopyJobRunner.class);

private final DataStorePluginOptions inputStoreOptions;
private final DataStorePluginOptions outputStoreOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
package org.locationtech.geowave.core.store.base;

import org.apache.log4j.Logger;
import org.locationtech.geowave.core.store.CloseableIterator;
import org.locationtech.geowave.core.store.DataStoreOptions;
import org.locationtech.geowave.core.store.adapter.AdapterIndexMappingStore;
Expand All @@ -28,7 +27,6 @@
* ID queries and row prefix queries.
*/
abstract class AbstractBaseRowQuery<T> extends BaseQuery {
private static final Logger LOGGER = Logger.getLogger(AbstractBaseRowQuery.class);

public AbstractBaseRowQuery(
final Index index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.IndexMetaData;
import org.locationtech.geowave.core.index.MultiDimensionalCoordinateRanges;
import org.locationtech.geowave.core.index.MultiDimensionalCoordinateRangesArray;
Expand Down Expand Up @@ -50,7 +51,7 @@
/** This class represents basic numeric contraints applied to a datastore query */
public class BaseConstraintsQuery extends BaseFilteredIndexQuery {

private static final Logger LOGGER = Logger.getLogger(BaseConstraintsQuery.class);
private static final Logger LOGGER = LogManager.getLogger(BaseConstraintsQuery.class);
private boolean queryFiltersEnabled;

public final Pair<InternalDataAdapter<?>, Aggregation<?, ?, ?>> aggregation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import java.util.Map;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.store.CloseableIterator;
import org.locationtech.geowave.core.store.CloseableIteratorWrapper;
import org.locationtech.geowave.core.store.DataStoreOptions;
Expand All @@ -41,7 +42,7 @@

abstract class BaseFilteredIndexQuery extends BaseQuery {
protected List<QueryFilter> clientFilters;
private static final Logger LOGGER = Logger.getLogger(BaseFilteredIndexQuery.class);
private static final Logger LOGGER = LogManager.getLogger(BaseFilteredIndexQuery.class);

public BaseFilteredIndexQuery(
final short[] adapterIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Logger;
import org.locationtech.geowave.core.index.MultiDimensionalCoordinateRangesArray;
import org.locationtech.geowave.core.index.QueryRanges;
import org.locationtech.geowave.core.index.numeric.MultiDimensionalNumericData;
Expand Down Expand Up @@ -41,7 +40,6 @@
* defined by the set of parameters passed into the constructor.
*/
abstract class BaseQuery {
private static final Logger LOGGER = Logger.getLogger(BaseQuery.class);

protected short[] adapterIds;
protected final Index index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.time.StopWatch;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.config.Configurator;
import org.locationtech.geowave.core.cli.annotations.GeowaveOperation;
import org.locationtech.geowave.core.cli.api.Command;
import org.locationtech.geowave.core.cli.api.DefaultOperation;
Expand Down Expand Up @@ -105,7 +108,7 @@ public boolean prepare(final OperationParams params) {
@Override
public void execute(final OperationParams params) {
if (debug) {
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.DEBUG);
Configurator.setLevel(LogManager.getRootLogger().getName(), Level.DEBUG);
}

// Ensure we have all the required arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import java.util.UUID;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArray;
import org.locationtech.geowave.core.index.ByteArrayRange;
import org.locationtech.geowave.core.index.ByteArrayUtils;
Expand Down Expand Up @@ -67,7 +68,7 @@
import com.google.common.primitives.UnsignedBytes;

public class MemoryDataStoreOperations implements DataStoreOperations {
private static final Logger LOGGER = Logger.getLogger(MemoryDataStoreOperations.class);
private static final Logger LOGGER = LogManager.getLogger(MemoryDataStoreOperations.class);
private final Map<String, SortedSet<MemoryStoreEntry>> storeData =
Collections.synchronizedMap(new HashMap<String, SortedSet<MemoryStoreEntry>>());
private final Map<MetadataType, SortedSet<MemoryMetadataEntry>> metadataStore =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.store.adapter.AdapterIndexMappingStore;
import org.locationtech.geowave.core.store.adapter.PersistentAdapterStore;
import org.locationtech.geowave.core.store.adapter.RowMergingDataAdapter;
Expand All @@ -25,7 +26,7 @@
import org.locationtech.geowave.core.store.query.filter.QueryFilter;

public class MergingEntryIterator<T> extends NativeEntryIteratorWrapper<T> {
private static final Logger LOGGER = Logger.getLogger(NativeEntryIteratorWrapper.class);
private static final Logger LOGGER = LogManager.getLogger(NativeEntryIteratorWrapper.class);

private final Map<Short, RowMergingDataAdapter> mergingAdapters;
private final Map<Short, RowTransform> transforms;
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
log4j.rootLogger=WARN, file
log4j.appender.file.File = ${geowave.home}/logs/geowave.log

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file=org.apache.logging.log4j.RollingFileAppender
log4j.appender.file.layout=org.apache.logging.log4j.core.layout.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n

log4j.category.org.geotools=WARN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import java.util.List;
import org.apache.commons.cli.ParseException;
import org.apache.commons.lang3.time.StopWatch;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.config.Configurator;
import org.locationtech.geowave.adapter.vector.cli.VectorSection;
import org.locationtech.geowave.core.cli.annotations.GeowaveOperation;
import org.locationtech.geowave.core.cli.api.Command;
Expand Down Expand Up @@ -78,7 +81,7 @@ public void setDebug(final boolean debug) {
@Override
public void execute(final OperationParams params) throws ParseException {
if (debug) {
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.DEBUG);
Configurator.setLevel(LogManager.getRootLogger().getName(), Level.DEBUG);
}

final StopWatch stopWatch = new StopWatch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
import org.apache.accumulo.monitor.Monitor;
import org.apache.hadoop.util.VersionInfo;
import org.apache.hadoop.util.VersionUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.log4j.spi.LoggerFactory;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Configurator;
/**
* Copyright (c) 2013-2017 Contributors to the Eclipse Foundation
*
Expand All @@ -36,7 +41,8 @@ protected static boolean isYarn() {
}

public static void main(final String[] args) throws Exception {
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.WARN);

Configurator.setLevel(LogManager.getRootLogger().getName(), Level.WARN);

final boolean interactive =
(System.getProperty("interactive") != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
package org.locationtech.geowave.datastore.accumulo.cli;

import org.apache.accumulo.shell.Shell;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.config.Configurator;

public class AccumuloMiniClusterShell {

public static void main(final String[] args) throws Exception {
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.WARN);
public static void main(final String[] args) throws Exception {
Configurator.setLevel(LogManager.getRootLogger().getName(), Level.WARN);

final String instanceName =
(System.getProperty("instanceName") != null) ? System.getProperty("instanceName")
Expand Down
2 changes: 1 addition & 1 deletion extensions/cli/cassandra-embed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
to avoid guava version conflicts) -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class HBaseMiniClusterClassLoader extends URLClassLoader {
"sunw.",
// logging
"org.apache.commons.logging",
"org.apache.log4j",
"org.apache.logging.log4j",
"com.hadoop",
// Hadoop/HBase/ZK:
"org.apache.hadoop.security",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@

import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.data.Mutation;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArray;
import org.locationtech.geowave.core.store.entities.GeoWaveRow;
import org.locationtech.geowave.core.store.operations.RowWriter;

abstract public class AbstractAccumuloWriter implements RowWriter {
private static final Logger LOGGER = Logger.getLogger(AbstractAccumuloWriter.class);
private static final Logger LOGGER = LogManager.getLogger(AbstractAccumuloWriter.class);
private org.apache.accumulo.core.client.BatchWriter batchWriter;
private final AccumuloOperations operations;
private final String tableName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import org.apache.accumulo.core.client.BatchDeleter;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArrayRange;
import org.locationtech.geowave.core.index.QueryRanges;
import org.locationtech.geowave.core.store.entities.GeoWaveRow;
import org.locationtech.geowave.core.store.entities.GeoWaveRowIteratorTransformer;
import org.locationtech.geowave.core.store.operations.Deleter;

public class AccumuloDeleter<T> extends AccumuloReader<T> implements Deleter<T> {
private static final Logger LOGGER = Logger.getLogger(AccumuloOperations.class);
private static final Logger LOGGER = LogManager.getLogger(AccumuloOperations.class);

private boolean closed = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
import org.apache.accumulo.core.security.Authorizations;
import org.apache.commons.lang.ArrayUtils;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.geowave.core.index.ByteArray;
import org.locationtech.geowave.core.index.ByteArrayRange;
import org.locationtech.geowave.core.index.ByteArrayUtils;
Expand Down Expand Up @@ -141,7 +142,7 @@ public class AccumuloOperations implements
ConnectorCloseListener,
Closeable {
private static Object CONNECTOR_MUTEX = new Object();
private static final Logger LOGGER = Logger.getLogger(AccumuloOperations.class);
private static final Logger LOGGER = LogManager.getLogger(AccumuloOperations.class);
private static final int DEFAULT_NUM_THREADS = 16;
private static final long DEFAULT_TIMEOUT_MILLIS = 1000L; // 1 second
private static final long DEFAULT_BYTE_BUFFER_SIZE = 1048576L; // 1 MB
Expand Down
Loading