summaryrefslogtreecommitdiffstats
path: root/daemon/src
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/src')
-rw-r--r--daemon/src/main/java/org/openslx/taskmanager/App.java5
-rw-r--r--daemon/src/main/properties/log4j2.properties21
2 files changed, 25 insertions, 1 deletions
diff --git a/daemon/src/main/java/org/openslx/taskmanager/App.java b/daemon/src/main/java/org/openslx/taskmanager/App.java
index cf63448..4251478 100644
--- a/daemon/src/main/java/org/openslx/taskmanager/App.java
+++ b/daemon/src/main/java/org/openslx/taskmanager/App.java
@@ -25,7 +25,10 @@ public class App
public static void main( String[] args ) throws InterruptedException, IOException
{
- Configurator.initialize( new DefaultConfiguration() );
+ // setup basic logging appender to log output on console if no external appender (log4j.properties) is configured
+ if (org.apache.logging.log4j.core.Logger.class.cast(LogManager.getRootLogger()).getAppenders().isEmpty()) {
+ Configurator.initialize(new DefaultConfiguration());
+ }
if (Global.PORT_UDP == -1 && Global.PORT_TCP == -1) {
log.fatal( "Neither UDP nor TCP configured" );
diff --git a/daemon/src/main/properties/log4j2.properties b/daemon/src/main/properties/log4j2.properties
new file mode 100644
index 0000000..563fe8d
--- /dev/null
+++ b/daemon/src/main/properties/log4j2.properties
@@ -0,0 +1,21 @@
+status=error
+name=log4j2PropertiesConfig
+
+#
+# root level logging configuration
+#
+rootLogger.level=all
+rootLogger.appenderRefs=stdout
+rootLogger.appenderRef.stdout.ref=logToConsole
+
+#
+# configuration for console output
+#
+appenders=console
+
+appender.console.type=Console
+appender.console.name=logToConsole
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=[%t] %-5p %F - %m%n
+appender.console.filter.threshold.type=ThresholdFilter
+appender.console.filter.threshold.level=info