diff --git a/deegree-core/deegree-core-annotations/pom.xml b/deegree-core/deegree-core-annotations/pom.xml
index 3b52c68221..c18b336a92 100644
--- a/deegree-core/deegree-core-annotations/pom.xml
+++ b/deegree-core/deegree-core-annotations/pom.xml
@@ -46,24 +46,16 @@
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-api
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-core
org.slf4j
- jcl-over-slf4j
-
-
- commons-io
- commons-io
+ slf4j-api
diff --git a/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/annotations/PackageLoggingNotes.java b/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/annotations/PackageLoggingNotes.java
index fbef5837b2..d0ef6f573b 100644
--- a/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/annotations/PackageLoggingNotes.java
+++ b/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/annotations/PackageLoggingNotes.java
@@ -54,7 +54,7 @@
public @interface PackageLoggingNotes {
/**
- * @return the string that can be used as title string delimiting a log4j.properties section
+ * @return the string that can be used as title string delimiting a log4j2.xml section
*/
String title() default "";
diff --git a/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/log4j/DuplicateMessageFilter.java b/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/log4j/DuplicateMessageFilter.java
index 7240e7b00e..a599e15ced 100644
--- a/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/log4j/DuplicateMessageFilter.java
+++ b/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/log4j/DuplicateMessageFilter.java
@@ -37,8 +37,8 @@
import static org.slf4j.LoggerFactory.getLogger;
-import org.apache.log4j.spi.Filter;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.slf4j.Logger;
/**
@@ -48,7 +48,7 @@
*
* @version $Revision: $, $Date: $
*/
-public class DuplicateMessageFilter extends Filter {
+public class DuplicateMessageFilter extends AbstractFilter {
private static final Logger LOG = getLogger( DuplicateMessageFilter.class );
@@ -57,26 +57,26 @@ public class DuplicateMessageFilter extends Filter {
private int count;
@Override
- public int decide( LoggingEvent event ) {
+ public Result filter( LogEvent event ) {
if ( last == null ) {
- last = event.getRenderedMessage();
+ last = event.getMessage().getFormattedMessage();
count = 0;
- return ACCEPT;
+ return Result.ACCEPT;
}
- if ( last.equals( event.getRenderedMessage() ) ) {
+ if ( last.equals( event.getMessage().getFormattedMessage() ) ) {
++count;
// would be cool to log (... repeated 12452 times)
if ( count % 100 == 0 ) {
LOG.warn( "Last message repeated 100 times." );
}
- return DENY;
+ return Result.DENY;
}
- last = event.getRenderedMessage();
+ last = event.getMessage().getFormattedMessage();
count = 1;
- return ACCEPT;
+ return Result.ACCEPT;
}
}
diff --git a/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/processors/LoggingAnnotationProcessor.java b/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/processors/LoggingAnnotationProcessor.java
index 0c73376cb2..792a2a5c5b 100644
--- a/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/processors/LoggingAnnotationProcessor.java
+++ b/deegree-core/deegree-core-annotations/src/main/java/org/deegree/commons/processors/LoggingAnnotationProcessor.java
@@ -75,7 +75,7 @@
@SupportedAnnotationTypes(value = { "org.deegree.commons.annotations.PackageLoggingNotes",
"org.deegree.commons.annotations.LoggingNotes" })
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedOptions({ "log4j.outputdir" })
public class LoggingAnnotationProcessor extends AbstractProcessor {
@@ -100,35 +100,35 @@ public void init( ProcessingEnvironment env ) {
}
// breaks the lines at max width
- String format( String str ) {
+ private String format( String str ) {
StringBuilder res = new StringBuilder();
outer: while ( str.length() > ( width - 3 ) ) {
int len = 3;
- res.append( "## " );
+ res.append( "\n" );
continue outer;
}
- res.append( str.substring( 0, idx + 1 ) );
- str = str.substring( idx + 1 );
+ res.append(str.substring(0, idx + 1));
+ str = str.substring(0, idx + 1);
len += idx + 1;
}
}
if ( !str.isEmpty() ) {
- res.append( "\n" );
+ res.append( " -->\n" );
}
}
if ( !str.isEmpty() ) {
- res.append( "## " + str );
+ res.append( "\n" );
}
return res.toString();
}
@@ -148,17 +148,18 @@ private void find( Element e, Tree root ) {
}
}
- void block( String text, RollbackPrintWriter out, boolean big ) {
+ private void block( String text, RollbackPrintWriter out, boolean big ) {
if ( big ) {
- out.print( "# " );
+ out.print( "");
out.println();
}
int odd = text.length() % 2;
int len = ( width - text.length() - 4 ) / 2;
- out.print( "# " );
+ out.print( "");
out.println();
if ( big ) {
- out.print( "# " );
+ out.print( "");
out.println();
}
out.println();
@@ -212,9 +215,7 @@ public boolean process( Set extends TypeElement> annotations, RoundEnvironment
tree.print( out, "", false, false, false, false, true );
out.close();
return true;
- } catch ( UnsupportedEncodingException e ) {
- e.printStackTrace();
- } catch ( FileNotFoundException e ) {
+ } catch ( UnsupportedEncodingException | FileNotFoundException e ) {
e.printStackTrace();
}
return false;
@@ -225,17 +226,16 @@ class Tree {
LoggingNotes notes;
- TreeMap children = new TreeMap();
+ TreeMap children = new TreeMap<>();
void insert( String qname, PackageLoggingNotes pnotes, LoggingNotes notes ) {
- LinkedList pkgs = new LinkedList( Arrays.asList( qname.split( "\\." ) ) );
+ LinkedList pkgs = new LinkedList<>( Arrays.asList( qname.split( "\\." ) ) );
Tree node = this;
while ( true ) {
String next = pkgs.poll();
Tree nextNode = node.children.get( next );
if ( nextNode == null ) {
nextNode = new Tree();
- // nextNode.segment = next;
node.children.put( next, nextNode );
}
node = nextNode;
@@ -257,41 +257,45 @@ void print( RollbackPrintWriter out, String qname, boolean error, boolean warn,
}
for ( Entry entry : children.entrySet() ) {
entry.getValue().print( out, qname + ( qname.isEmpty() ? "" : "." ) + entry.getKey(), error, warn,
- info, debug, trace );
+ info, debug, trace );
}
out.rollback();
}
private void handleNotes( RollbackPrintWriter out, String qname, boolean error, boolean warn, boolean info,
boolean debug, boolean trace ) {
- handleNote( out, error, notes.error(), qname, "ERROR" );
- handleNote( out, warn, notes.warn(), qname, "WARN" );
- handleNote( out, info, notes.info(), qname, "INFO" );
- handleNote( out, debug, notes.debug(), qname, "DEBUG" );
- handleNote( out, trace, notes.trace(), qname, "TRACE" );
+ handleNote( out, error, notes.error(), qname, "error" );
+ handleNote( out, warn, notes.warn(), qname, "warn" );
+ handleNote( out, info, notes.info(), qname, "info" );
+ handleNote( out, debug, notes.debug(), qname, "debug" );
+ handleNote( out, trace, notes.trace(), qname, "trace" );
}
private void handlePackageNotes( RollbackPrintWriter out, String qname, boolean error, boolean warn,
boolean info, boolean debug, boolean trace ) {
String title = pnotes.title();
- boolean isSubsystem = qname.replaceAll( "[^\\.]", "" ).length() == 2;
+ boolean isSubsystem = qname.replaceAll( "[^.]", "" ).length() == 2;
if ( !title.isEmpty() ) {
block( title, out, isSubsystem );
}
- handleNote( out, error, pnotes.error(), qname, "ERROR" );
- handleNote( out, warn, pnotes.warn(), qname, "WARN" );
- handleNote( out, info, pnotes.info(), qname, "INFO" );
- handleNote( out, debug, pnotes.debug(), qname, "DEBUG" );
- handleNote( out, trace, pnotes.trace(), qname, "TRACE" );
+ handleNote( out, error, pnotes.error(), qname, "error" );
+ handleNote( out, warn, pnotes.warn(), qname, "warn" );
+ handleNote( out, info, pnotes.info(), qname, "info" );
+ handleNote( out, debug, pnotes.debug(), qname, "debug" );
+ handleNote( out, trace, pnotes.trace(), qname, "trace" );
}
private void handleNote( RollbackPrintWriter out, boolean level, String note, String qname, String levelName ) {
if ( !note.isEmpty() && level ) {
out.println( format( note ) );
- out.println( "#log4j.logger." + qname + " = " + levelName );
+ out.println("");
out.println();
out.flush();
}
diff --git a/deegree-core/deegree-core-annotations/src/main/resources/log4j.properties b/deegree-core/deegree-core-annotations/src/main/resources/log4j.properties
deleted file mode 100644
index 38967b3129..0000000000
--- a/deegree-core/deegree-core-annotations/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-# default logging file to have log4j always set up
-# by default, only log to stdout
-log4j.rootLogger=ERROR, stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %5p: [%c{1}] %m%n
-
-# The log level for all classes that are not configured below.
-log4j.logger.org.deegree = INFO
diff --git a/deegree-core/deegree-core-annotations/src/main/resources/log4j2.xml b/deegree-core/deegree-core-annotations/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..fb86cc24bd
--- /dev/null
+++ b/deegree-core/deegree-core-annotations/src/main/resources/log4j2.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/deegree-core/deegree-core-commons/pom.xml b/deegree-core/deegree-core-commons/pom.xml
index d6528ba1ad..8fb8f5fc7d 100644
--- a/deegree-core/deegree-core-commons/pom.xml
+++ b/deegree-core/deegree-core-commons/pom.xml
@@ -115,6 +115,14 @@
javax.mail
mail
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ jcl-over-slf4j
+
junit
junit
diff --git a/deegree-core/deegree-core-workspace/pom.xml b/deegree-core/deegree-core-workspace/pom.xml
index 19e7c82705..01ad1f961f 100644
--- a/deegree-core/deegree-core-workspace/pom.xml
+++ b/deegree-core/deegree-core-workspace/pom.xml
@@ -34,6 +34,10 @@
deegree-core-annotations
${project.version}
+
+ commons-io
+ commons-io
+
org.reflections
reflections
diff --git a/deegree-services/deegree-services-commons/src/api/java/org/deegree/services/controller/OGCFrontController.java b/deegree-services/deegree-services-commons/src/api/java/org/deegree/services/controller/OGCFrontController.java
index 40fce1e4f8..eb32536be1 100644
--- a/deegree-services/deegree-services-commons/src/api/java/org/deegree/services/controller/OGCFrontController.java
+++ b/deegree-services/deegree-services-commons/src/api/java/org/deegree/services/controller/OGCFrontController.java
@@ -94,7 +94,6 @@
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.LogFactory;
-import org.apache.log4j.LogManager;
import org.deegree.commons.annotations.LoggingNotes;
import org.deegree.commons.concurrent.Executor;
import org.deegree.commons.config.DeegreeWorkspace;
@@ -1401,7 +1400,6 @@ private void plugClassLoaderLeaks() {
Executor.getInstance().shutdown();
LogFactory.releaseAll();
- LogManager.shutdown();
// image io
Iterator> i = IIORegistry.getDefaultInstance().getCategories();
diff --git a/pom.xml b/pom.xml
index 10a560c11f..86a04c3e01 100644
--- a/pom.xml
+++ b/pom.xml
@@ -531,38 +531,29 @@
- log4j
- log4j
- 1.2.17
-
-
- javax.jms
- jms
-
-
- com.sun.jdmk
- jmxtools
-
-
- com.sun.jmx
- jmxri
-
-
+ org.apache.logging.log4j
+ log4j-api
+ 2.11.2
- org.slf4j
- slf4j-api
- 1.7.13
+ org.apache.logging.log4j
+ log4j-core
+ 2.11.2
+
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ 2.11.2
org.slf4j
- slf4j-log4j12
- 1.7.13
+ slf4j-api
+ 1.7.26
org.slf4j
jcl-over-slf4j
- 1.7.13
+ 1.7.26