Skip to content

Commit

Permalink
JENA-1005: Switch from log4j1 to log4j2
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Mar 19, 2020
1 parent 028643a commit f9deb35
Show file tree
Hide file tree
Showing 112 changed files with 1,678 additions and 1,257 deletions.
2 changes: 1 addition & 1 deletion apache-jena/assembly-jena-zip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<fileSet>
<outputDirectory></outputDirectory>
<includes>
<include>jena-log4j.properties</include>
<include>log4j2.properties</include>
</includes>
<fileMode>0644</fileMode>
</fileSet>
Expand Down
35 changes: 0 additions & 35 deletions apache-jena/jena-log4j.properties

This file was deleted.

38 changes: 38 additions & 0 deletions apache-jena/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
status = error
name = PropertiesConfig
filters = threshold

filter.threshold.type = ThresholdFilter
filter.threshold.level = INFO

appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %m%n
#appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-15c{1} :: %m%n

rootLogger.level = INFO
rootLogger.appenderRef.stdout.ref = STDOUT

logger.jena.name = org.apache.jena
logger.jena.level = INFO

logger.arq-info.name = org.apache.jena.arq.info
logger.arq-info.level = INFO

logger.arq-exec.name = org.apache.jena.arq.exec
logger.arq-exec.level = INFO

logger.riot.name = org.apache.jena.riot
logger.riot.level = INFO

# Loaders
logger.tdb1-loader.name = org.apache.jena.tdb.loader
logger.tdb1-loader.level = INFO

logger.tdb2-loader.name = org.apache.jena.tdb2.loader
logger.tdb2-loader.level = INFO

logger.tdb.name = TDB
logger.tdb.level = INFO
13 changes: 3 additions & 10 deletions apache-jena/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,13 @@
<version>3.15.0-SNAPSHOT</version>
</dependency>

<!-- Require a logging implementation for command line tools -->
<!-- Require a logging implementation for command line tools -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>compile</scope>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-cmds</artifactId>
Expand Down
35 changes: 0 additions & 35 deletions jena-arq/log4j.properties

This file was deleted.

12 changes: 12 additions & 0 deletions jena-arq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,24 @@
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,39 @@ public final DatasetGraph getWrapped() {
return get();
}

/** Recursively unwrap a {@link DatasetGraphWrapper}.
/**
* Recursively unwrap a {@link DatasetGraphWrapper}.
* <p>
* Note 1: Some use of DatasetGraphWrapper does not use
* the wrapped dataset stored in this object.
* <p>
* Note 2: TDB datasets require a transaction to unwrap.
*
* @return the first found {@link DatasetGraph} that is not an instance of {@link DatasetGraphWrapper}
* @return the first found {@link DatasetGraph} that is not an instance of
* {@link DatasetGraphWrapper}
*/
public final DatasetGraph getBase() {
DatasetGraph dsgw = dsg;
DatasetGraph dsgw = get();
while (dsgw instanceof DatasetGraphWrapper) {
dsgw = ((DatasetGraphWrapper)dsg).getWrapped();
dsgw = ((DatasetGraphWrapper)dsgw).getWrapped();
}
return dsgw;
}

/**
* Unwrap a {@code DatasetGraph} to find the base {@code DatasetGraph}.
* Calls {@link #getBase} if the argument is a {@code DatasetGraphWrapper}.
* <p>
* Note 1: Some use of DatasetGraphWrapper does not use
* the wrapped dataset stored in this object.
* <p>
* Note 2: TDB datasets require a transaction to unwrap.
*/
public static DatasetGraph unwrap(DatasetGraph dsg) {
if ( ! ( dsg instanceof DatasetGraphWrapper) )
return dsg;
return ((DatasetGraphWrapper)dsg).getBase();
}

/** Recursively unwrap a {@link DatasetGraphWrapper}, stopping at a {@link DatasetGraphWrapper}
* that indicate it is "view changing", ie shows quads to the base dataset graph.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@
import org.junit.BeforeClass ;
import org.junit.Test ;

/** This test suite does external network traffic.
* It causes INFO level messages if the network interface is not reachable.
* It does not cause tests to fail.
*/
public class TestService {
private static final String SERVICE = "http://example.com:40000";
// TODO Move to jena-integration-tests and use a Fuskei server as target.
private static final String SERVICE = "http://example.com:40000/";

private static Object value ;

Expand Down
18 changes: 0 additions & 18 deletions jena-arq/src/test/resources/log4j-testing.properties

This file was deleted.

18 changes: 0 additions & 18 deletions jena-arq/src/test/resources/log4j.properties

This file was deleted.

30 changes: 30 additions & 0 deletions jena-arq/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

status = error
name = PropertiesConfig
filters = threshold

filter.threshold.type = ThresholdFilter
filter.threshold.level = INFO

appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-10c{1} :: %m%n
#appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-10c{1} :: %m%n

rootLogger.level = INFO
rootLogger.appenderRef.stdout.ref = STDOUT

logger.jena.name = org.apache.jena
logger.jena.level = WARN

logger.arq-info.name = org.apache.jena.arq.info
logger.arq-info.level = INFO

logger.riot.name = org.apache.jena.riot
logger.riot.level = INFO

# May be useful to turn up to DEBUG if debugging HTTP communication issues
logger.apache-http.name = org.apache.http
logger.apache-http.level = WARN
13 changes: 6 additions & 7 deletions jena-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
<version>3.15.0-SNAPSHOT</version>
</dependency>

<!-- For compiling the log4j1 helper code. -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<optional>true</optional>
</dependency>

<!-- For compiling the log4j2 helper code. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down Expand Up @@ -99,6 +92,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
Loading

0 comments on commit f9deb35

Please sign in to comment.