diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/openslx/imagemaster/App.java | 21 | ||||
-rw-r--r-- | src/main/properties/log4j.properties | 15 |
2 files changed, 21 insertions, 15 deletions
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 |