summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-06-01 14:13:11 +0200
committerManuel Bentele2021-06-01 14:13:11 +0200
commit033239af5af57551ac2424f0e46b594484dbb1ca (patch)
tree46d363f40407313ab95e26f458ad71be0d2988e9
parentRefactor container network to match common Docker network (diff)
downloadmasterserver-033239af5af57551ac2424f0e46b594484dbb1ca.tar.gz
masterserver-033239af5af57551ac2424f0e46b594484dbb1ca.tar.xz
masterserver-033239af5af57551ac2424f0e46b594484dbb1ca.zip
Set log4j debug level for console (INFO)
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/openslx/imagemaster/App.java21
-rw-r--r--src/main/properties/log4j.properties15
3 files changed, 22 insertions, 16 deletions
diff --git a/pom.xml b/pom.xml
index 2fec4f9..993cae3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -138,7 +138,7 @@
<resource>
<directory>src/main/properties</directory>
<includes>
- <include>**/*.properties</include>
+ <include>*.properties</include>
</includes>
</resource>
</resources>
diff --git a/src/main/java/org/openslx/imagemaster/App.java b/src/main/java/org/openslx/imagemaster/App.java
index 4bb7730..6b68770 100644
--- a/src/main/java/org/openslx/imagemaster/App.java
+++ b/src/main/java/org/openslx/imagemaster/App.java
@@ -6,11 +6,13 @@ import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.thrift.transport.TTransportException;
import org.openslx.imagemaster.localrpc.NetworkHandler;
import org.openslx.imagemaster.thrift.server.BinaryListener;
-import org.slf4j.LoggerFactory;
+import org.openslx.sat.thrift.version.Version;
/**
* The main class that starts all the services.
@@ -22,16 +24,17 @@ public class App
private static List<Thread> servers = new ArrayList<>();
- static {
- // This is a temporary workaround for this annoying log4j error msg.
- // It's initializing the logger before anything else is done.
- LoggerFactory.getLogger( "ROOT" );
- }
-
public static void main( String[] args ) throws TTransportException, NoSuchAlgorithmException, SocketException
{
- // Init logging
- log.info( "Starting Application" );
+ // setup basic logging appender to log output on console if no external appender (log4j.properties) is configured
+ if ( LogManager.getRootLogger().getAllAppenders() == null ) {
+ BasicConfigurator.configure();
+ }
+
+ log.info( "****************************************************************" );
+ log.info( "******************* Starting Application ***********************" );
+ log.info( "****************************************************************" );
+ log.info( "RPC version " + Version.VERSION );
// Create binary listener
Thread t;
diff --git a/src/main/properties/log4j.properties b/src/main/properties/log4j.properties
index 881887e..3baa9b6 100644
--- a/src/main/properties/log4j.properties
+++ b/src/main/properties/log4j.properties
@@ -1,11 +1,14 @@
-log4j.rootLogger=DEBUG, A1
+# root level logging configuration
+log4j.rootLogger=ALL, console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %F - %m%n
+# configuration for console output
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=[%t] %-5p %F - %m%n
+log4j.appender.console.encoding=UTF-8
+log4j.appender.console.Threshold=INFO
+# overwrite logging level for specific packages and classes
log4j.logger.org.apache.directory=ERROR
log4j.logger.org.apache.mina=ERROR
log4j.logger.org.apache.thrift.server.AbstractNonblockingServer=ERROR