Skip to content

Move logging to slf4j #829

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ext {
'elasticsearch' : '2.3.4',
'elasticsearch-helper' : '2.3.4.0',
'log4j': '2.5',
'slf4j': '1.7.23',
'wagon' : '2.10',
'jsr166e': '1.1.0',
'jna' : '4.1.0',
Expand Down Expand Up @@ -83,8 +84,7 @@ configurations {
dependencies {
compile 'org.elasticsearch:elasticsearch:' + versions.elasticsearch
compile 'org.xbib.elasticsearch.plugin:elasticsearch-helper:' + versions.'elasticsearch-helper'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:' + versions.log4j
compile 'org.apache.logging.log4j:log4j-core:'+ versions.log4j
compile 'org.slf4j:slf4j-api:' + versions.slf4j
compile('com.vividsolutions:jts:' + versions.jts) {
exclude group: 'xerces'
}
Expand All @@ -93,12 +93,13 @@ dependencies {
// Workaround for a known issue with TestNG 6.x: explicitly add Guice (Gradle will fail to run tests otherwise)
testCompile 'com.google.inject:guice:3.0'
testCompile 'org.uncommons:reportng:1.1.4'
testCompile 'org.apache.logging.log4j:log4j-slf4j-impl:' + versions.log4j
testCompile 'org.apache.logging.log4j:log4j-core:'+ versions.log4j
compile 'org.slf4j:slf4j-api:' + versions.slf4j
integrationTestCompile 'org.testng:testng:' + versions.testng
integrationTestCompile 'org.elasticsearch:elasticsearch:' + versions.elasticsearch
integrationTestCompile 'net.java.dev.jna:jna:' + versions.jna
// for distribution
driverJars 'org.apache.logging.log4j:log4j-slf4j-impl:' + versions.log4j
driverJars 'org.apache.logging.log4j:log4j-core:'+ versions.log4j
driverJars('org.xbib.jdbc:jdbc-driver-csv:' + versions.'jdbc-driver-csv') {
exclude group: 'org.apache.logging.log4j'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package org.xbib.elasticsearch.common.metrics;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.util.FormatUtil;

import java.text.NumberFormat;
Expand All @@ -27,13 +27,13 @@

public class MetricsLogger {

private final static Logger plainsourcelogger = LogManager.getLogger("metrics.source.plain");
private final static Logger plainsourcelogger = LoggerFactory.getLogger("metrics.source.plain");

private final static Logger plainsinklogger = LogManager.getLogger("metrics.sink.plain");
private final static Logger plainsinklogger = LoggerFactory.getLogger("metrics.sink.plain");

private final static Logger jsonsourcelogger = LogManager.getLogger("metrics.source.json");
private final static Logger jsonsourcelogger = LoggerFactory.getLogger("metrics.source.json");

private final static Logger jsonsinklogger = LogManager.getLogger("metrics.sink.json");
private final static Logger jsonsinklogger = LoggerFactory.getLogger("metrics.sink.json");

private final static NumberFormat formatter = NumberFormat.getNumberInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.column;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.keyvalue.KeyValueStreamListener;
import org.xbib.elasticsearch.jdbc.strategy.standard.StandardSource;
import org.xbib.elasticsearch.common.util.IndexableObject;
Expand All @@ -42,7 +42,7 @@
*/
public class ColumnSource<C extends ColumnContext> extends StandardSource<C> {

private static final Logger logger = LogManager.getLogger("importer.jdbc.source.column");
private static final Logger logger = LoggerFactory.getLogger("importer.jdbc.source.column");

private static final String WHERE_CLAUSE_PLACEHOLDER = "$where";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.standard;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.metrics.MetricsLogger;
import org.xbib.elasticsearch.common.util.LocaleUtil;
import org.xbib.elasticsearch.common.util.StrategyLoader;
Expand Down Expand Up @@ -53,7 +53,7 @@
*/
public class StandardContext<S extends JDBCSource> implements Context<S, Sink> {

private final static Logger logger = LogManager.getLogger("importer.jdbc.context.standard");
private final static Logger logger = LoggerFactory.getLogger("importer.jdbc.context.standard");

private Settings settings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.standard;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
import org.elasticsearch.action.delete.DeleteRequest;
Expand All @@ -33,6 +31,8 @@
import org.elasticsearch.indices.IndexAlreadyExistsException;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.metrics.SinkMetric;
import org.xbib.elasticsearch.common.util.ControlKeys;
import org.xbib.elasticsearch.common.util.IndexableObject;
Expand All @@ -56,7 +56,7 @@
*/
public class StandardSink<C extends StandardContext> implements Sink<C> {

private final static Logger logger = LogManager.getLogger("importer.jdbc.sink.standard");
private final static Logger logger = LoggerFactory.getLogger("importer.jdbc.sink.standard");

protected C context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.standard;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.unit.TimeValue;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.keyvalue.KeyValueStreamListener;
import org.xbib.elasticsearch.common.util.ExceptionFormatter;
import org.xbib.elasticsearch.common.metrics.SourceMetric;
Expand Down Expand Up @@ -71,7 +71,7 @@
*/
public class StandardSource<C extends StandardContext> implements JDBCSource<C> {

private final static Logger logger = LogManager.getLogger("importer.jdbc.source.standard");
private final static Logger logger = LoggerFactory.getLogger("importer.jdbc.source.standard");

protected C context;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/xbib/pipeline/AbstractPipeline.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

package org.xbib.pipeline;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
Expand All @@ -16,7 +16,7 @@
public abstract class AbstractPipeline<R extends PipelineRequest>
implements Pipeline<R> {

private final static Logger logger = LogManager.getLogger(AbstractPipeline.class);
private final static Logger logger = LoggerFactory.getLogger(AbstractPipeline.class);

private BlockingQueue<R> queue; //= new SynchronousQueue<>(true);

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/xbib/tools/JDBCImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package org.xbib.tools;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.cron.CronExpression;
import org.xbib.elasticsearch.common.cron.CronThreadPoolExecutor;
import org.xbib.elasticsearch.common.util.StrategyLoader;
Expand Down Expand Up @@ -54,7 +54,7 @@ public class JDBCImporter
extends AbstractPipeline<SettingsPipelineRequest>
implements Runnable, CommandLineInterpreter {

private final static Logger logger = LogManager.getLogger("importer.jdbc");
private final static Logger logger = LoggerFactory.getLogger("importer.jdbc");

private Context context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.spatial4j.core.context.SpatialContext;
import com.spatial4j.core.context.jts.JtsSpatialContext;
import com.spatial4j.core.shape.Shape;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import java.io.IOException;
Expand All @@ -15,7 +15,7 @@

public class GeometryTests {

protected final static Logger logger = LogManager.getLogger("test.geo");
protected final static Logger logger = LoggerFactory.getLogger("test.geo");

@Test
public void convert() throws ParseException, IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.xbib.elasticsearch.jdbc.strategy.column;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import org.xbib.elasticsearch.jdbc.strategy.Context;
Expand All @@ -25,7 +25,7 @@

public class ColumnStrategySourceTests extends AbstractColumnStrategyTest {

private final static Logger logger = LogManager.getLogger("test.column.source");
private final static Logger logger = LoggerFactory.getLogger("test.column.source");

private Random random = new Random();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.mock;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbib.elasticsearch.common.metrics.SinkMetric;
import org.xbib.elasticsearch.common.util.IndexableObject;
import org.xbib.elasticsearch.jdbc.strategy.Sink;
Expand All @@ -27,7 +27,7 @@

public class MockSink implements Sink<MockContext> {

private final static Logger logger = LogManager.getLogger(MockSink.class);
private final static Logger logger = LoggerFactory.getLogger(MockSink.class);

private Map<IndexableObject, String> data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.standard;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.settings.Settings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Optional;
Expand Down Expand Up @@ -45,7 +45,7 @@

public abstract class AbstractSinkTest extends NodeTestUtils {

protected final static Logger logger = LogManager.getLogger("test.target");
protected final static Logger logger = LoggerFactory.getLogger("test.target");

protected static JDBCSource source;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.standard;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
Expand Down Expand Up @@ -44,7 +44,7 @@

public abstract class AbstractSourceTest extends Assert {

protected final static Logger logger = LogManager.getLogger("test.source");
protected final static Logger logger = LoggerFactory.getLogger("test.source");

protected static JDBCSource source;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.xbib.elasticsearch.jdbc.strategy.standard;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
Expand All @@ -37,7 +37,7 @@

public class StandardSourceTests extends AbstractSourceTest {

private static final Logger logger = LogManager.getLogger(StandardSourceTests.class.getName());
private static final Logger logger = LoggerFactory.getLogger(StandardSourceTests.class.getName());

@Override
public JDBCSource newSource() {
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/xbib/elasticsearch/util/TestListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/
package org.xbib.elasticsearch.util;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;

public class TestListener implements ITestListener {

private final Logger logger = LogManager.getLogger("test.Listener");
private final Logger logger = LoggerFactory.getLogger("test.Listener");

@Override
public void onTestStart(ITestResult result) {
Expand Down