Skip to content

Commit

Permalink
releng: Replace org.apache.log4j with org.slf4j.binding.simple
Browse files Browse the repository at this point in the history
SWTBot project has removed org.apache.log4j from their update site since
version 4.0.0 in 2022-06 with Bug 578065. It is instead using org.slf4j.
Trace Compass has been using fixed SWTBot version 3.1.0 since then. It
will now use the latest SWTBot release and use slf4j api for logging,
with the simplelogger binding.

Update all targets to use latest SWTBot repository.

Update all targets to add org.slf4j.binding.simple from Orbit.

Update all *.swtbot.tests plug-ins to remove dependency on
org.apache.log4j and add dependency on org.slf4j as an Import-Package.

Remove log4j logger configuration from all SWTBot tests.

Update pom.xml to add org.slf4j.binding.simple as extraRequirement for
SWTBot test plug-ins. This enables the binding in CI.

Create org.eclipse.tracecompass.slf4j.binding.simple.properties fragment
plug-in to org.slf4j.api fragment host to include
simplelogger.properties file that configures simplelogger to use
System.out as logFile and debug as defaultLogLevel.

[Changed] Replace org.apache.log4j with org.slf4j.binding.simple

Change-Id: Ife62c8107e9dfe052498439f2a8401ae13caa160
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/193250
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
PatrickTasse committed May 31, 2023
1 parent 7b5def8 commit b1d2749
Show file tree
Hide file tree
Showing 87 changed files with 201 additions and 709 deletions.
Expand Up @@ -24,4 +24,4 @@ Require-Bundle: org.eclipse.equinox.registry,
org.junit
Export-Package: org.eclipse.tracecompass.analysis.callstack.ui.swtbot.tests;x-internal:=true
Import-Package: com.google.common.collect,
org.apache.log4j
org.slf4j
Expand Up @@ -23,9 +23,6 @@
import java.util.Spliterators;
import java.util.stream.StreamSupport;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
Expand Down Expand Up @@ -67,8 +64,6 @@ public class FlameGraphTest extends AggregationTreeTest {
private static final String SECONDARY_ID = "org.eclipse.tracecompass.analysis.callstack.ui.swtbot.test";
private static final String FLAMEGRAPH_ID = FlameGraphView.ID;

private static final Logger fLogger = Logger.getRootLogger();

private SWTWorkbenchBot fBot;
private SWTBotView fViewBot;
private FlameGraphView fFg;
Expand All @@ -86,8 +81,6 @@ public static void beforeClass() {
/* set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
SWTWorkbenchBot bot = new SWTWorkbenchBot();
SWTBotUtils.closeView("welcome", bot);
/* Switch perspectives */
Expand Down
Expand Up @@ -29,6 +29,7 @@ Require-Bundle: org.eclipse.core.resources,
Import-Package: org.apache.commons.io,
org.eclipse.swt.graphics,
org.eclipse.swtchart,
org.eclipse.tracecompass.analysis.counters.core
org.eclipse.tracecompass.analysis.counters.core,
org.slf4j
Automatic-Module-Name: org.eclipse.tracecompass.analysis.counters.ui.swtbot.tests
Export-Package: org.eclipse.tracecompass.analysis.counters.ui.swtbot.tests;x-internal:=true
Expand Up @@ -9,8 +9,7 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Fragment-Host: org.eclipse.tracecompass.analysis.lami.ui
Export-Package: org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.views;x-internal:=true
Require-Bundle: org.apache.log4j,
org.eclipse.core.resources,
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.junit4_x,
Expand All @@ -32,5 +31,6 @@ Require-Bundle: org.apache.log4j,
org.eclipse.tracecompass.tmf.chart.ui.swtbot.tests,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
Import-Package: com.google.common.collect,
org.eclipse.swtchart
org.eclipse.swtchart,
org.slf4j
Automatic-Module-Name: org.eclipse.tracecompass.analysis.lami.ui.swtbot.tests
Expand Up @@ -17,9 +17,6 @@
import java.util.Arrays;
import java.util.Collections;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
Expand All @@ -38,8 +35,8 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.swtchart.Chart;
import org.eclipse.tracecompass.analysis.lami.core.tests.shared.analysis.LamiAnalyses;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiResultTable;
import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry;
import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiLongNumber;
Expand All @@ -61,7 +58,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.eclipse.swtchart.Chart;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand All @@ -84,9 +80,6 @@ public class LamiChartViewerTest {
private static final String VIEW_ID = LamiReportView.VIEW_ID;
private static final TmfTestTrace TRACE = TmfTestTrace.A_TEST_10K;

/** The Log4j logger instance. */
private static final Logger fLogger = NonNullUtils.checkNotNull(Logger.getRootLogger());

private final SWTWorkbenchBot fBot = new SWTWorkbenchBot();
private @Nullable SWTBotView fViewBot = null;
private @Nullable LamiReportViewTabPage fCurrentTab;
Expand All @@ -103,8 +96,6 @@ public static void beforeClass() {
/* set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();

Expand All @@ -127,7 +118,6 @@ public static void afterClass() {
SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.closeAllEditors();
SWTBotUtils.deleteProject(PROJECT_NAME, bot);
fLogger.removeAllAppenders();
OnDemandAnalysisManager.getInstance().unregisterAnalysis(LamiAnalyses.MULTIPLE_ROW.getAnalysis());
OnDemandAnalysisManager.getInstance().unregisterAnalysis(LamiAnalyses.MULTIPLE_SIMILAR_ROW.getAnalysis());
}
Expand Down
Expand Up @@ -9,8 +9,7 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.latency,
org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.perf.views
Require-Bundle: org.apache.log4j,
org.eclipse.core.resources,
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.core.tests,
Expand Down Expand Up @@ -38,5 +37,6 @@ Require-Bundle: org.apache.log4j,
Import-Package: com.google.common.collect,
org.apache.commons.io,
org.eclipse.swtchart,
org.eclipse.tracecompass.testtraces.ctf
org.eclipse.tracecompass.testtraces.ctf,
org.slf4j
Automatic-Module-Name: org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests
Expand Up @@ -24,9 +24,6 @@
import java.lang.reflect.Field;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
Expand All @@ -38,6 +35,8 @@
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtchart.Chart;
import org.eclipse.swtchart.Range;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density2.AbstractSegmentStoreDensityView;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.SystemCallLatencyDensityView;
Expand All @@ -48,13 +47,10 @@
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.eclipse.swtchart.Chart;
import org.eclipse.swtchart.Range;

/**
* Tests of the density view
Expand All @@ -68,8 +64,6 @@ public class SystemCallLatencyDensityViewTest {
private static final String PROJECT_NAME = "test";
private static final String VIEW_ID = SystemCallLatencyDensityView.ID;

/** The Log4j logger instance. */
private static final Logger fLogger = Logger.getRootLogger();
private AbstractSegmentStoreDensityView fDensityView;
private AbstractSegmentStoreTableViewer fDensityViewer;
private Chart fDensityChart;
Expand All @@ -86,22 +80,12 @@ public static void beforeClass() {
/* set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
fBot = new SWTWorkbenchBot();
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();

}

/**
* Clean up
*/
@AfterClass
public static void afterClass() {
fLogger.removeAllAppenders();
}

/**
* Opens a latency table
*
Expand Down
Expand Up @@ -25,9 +25,6 @@
import java.lang.reflect.Method;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
Expand All @@ -48,7 +45,6 @@
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand All @@ -72,8 +68,6 @@ public class SystemCallLatencyStatisticsTableAnalysisTest {
private static final String PRIMARY_VIEW_ID = SegmentStoreStatisticsView.ID;
private static final String SECONDARY_VIEW_ID = SystemCallLatencyAnalysis.ID;

/** The Log4j logger instance. */
private static final Logger fLogger = Logger.getRootLogger();
private SWTBotTree fTreeBot;
private static SWTWorkbenchBot fBot;

Expand All @@ -87,22 +81,12 @@ public static void beforeClass() {
/* set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
fBot = new SWTWorkbenchBot();
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();

}

/**
* Clean up
*/
@AfterClass
public static void afterClass() {
fLogger.removeAllAppenders();
}

/**
* Opens a latency table
*/
Expand Down
Expand Up @@ -9,8 +9,7 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.tracecompass.analysis.profiling.ui.swtbot.tests.callgraph;x-internal:=true,
org.eclipse.tracecompass.analysis.profiling.ui.swtbot.tests.flamegraph;x-internal:=true
Require-Bundle: org.apache.log4j,
org.eclipse.core.resources,
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.core.tests,
Expand All @@ -37,5 +36,6 @@ Require-Bundle: org.apache.log4j,
org.eclipse.tracecompass.analysis.profiling.ui,
org.eclipse.tracecompass.analysis.profiling.core.tests,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
Import-Package: com.google.common.collect
Import-Package: com.google.common.collect,
org.slf4j
Automatic-Module-Name: org.eclipse.tracecompass.analysis.profiling.ui.swtbot.tests
Expand Up @@ -21,9 +21,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
Expand All @@ -46,7 +43,6 @@
import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils;
import org.eclipse.ui.IViewPart;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -85,9 +81,6 @@ public void chartUpdated() {
private AbstractSegmentStoreTableViewer fTableViewer;
private CountDownLatch fLatch;

/** The Log4j logger instance. */
private static final Logger fLogger = Logger.getRootLogger();

/**
* Initialization
*/
Expand All @@ -99,20 +92,10 @@ public static void beforeClass() {
/* set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();
}

/**
* Clean up
*/
@AfterClass
public static void afterClass() {
fLogger.removeAllAppenders();
}

/**
* Setup for the test
*/
Expand Down
Expand Up @@ -24,9 +24,6 @@
import java.util.Spliterators;
import java.util.stream.StreamSupport;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
Expand All @@ -49,7 +46,6 @@
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent;
import org.eclipse.ui.IViewPart;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand All @@ -67,8 +63,6 @@ public class FlameGraphTest extends AggregationTreeTest {
private SWTWorkbenchBot fBot;
private SWTBotView fView;
private FlameGraphView fFg;
/** The Log4j logger instance. */
private static final Logger fLogger = Logger.getRootLogger();
private TimeGraphViewer fTimeGraphViewer;

/**
Expand All @@ -82,20 +76,10 @@ public static void beforeClass() {
/* set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();
}

/**
* Clean up
*/
@AfterClass
public static void afterClass() {
fLogger.removeAllAppenders();
}

/**
* Open a flamegraph
*/
Expand Down
Expand Up @@ -8,8 +8,7 @@ Bundle-SymbolicName: org.eclipse.tracecompass.analysis.timing.ui.swtbot.tests;si
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.tracecompass.analysis.timing.ui.swtbot.tests.table
Require-Bundle: org.apache.log4j,
org.eclipse.core.resources,
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.core.tests,
Expand All @@ -32,5 +31,6 @@ Require-Bundle: org.apache.log4j,
org.eclipse.tracecompass.segmentstore.core,
org.eclipse.tracecompass.datastore.core,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
Import-Package: com.google.common.collect
Import-Package: com.google.common.collect,
org.slf4j
Automatic-Module-Name: org.eclipse.tracecompass.analysis.timing.ui.swtbot.tests

0 comments on commit b1d2749

Please sign in to comment.