Skip to content

Commit

Permalink
Log JUL messages to stdout through logging.properties configuration file
Browse files Browse the repository at this point in the history
This is a (temporary) workaround because for some reason
logging-activator does not work anymore (when used in the assembly).
  • Loading branch information
bertfrees committed Sep 19, 2023
1 parent f2dec8f commit ee47a85
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1868,10 +1868,16 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</artifactItem>
<artifactItem>
<!--
Disabled because for some reason (and it's not because logging-activator was
merged into common-utils) it does not work anymore when used in the
assembly. (It does work in unit tests.) As a workaround, log JUL messages to
stdout through the logging.properties configuration file.
-->
<!--<artifactItem>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</artifactItem>
</artifactItem>-->
<artifactItem>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
Expand Down Expand Up @@ -3308,6 +3314,7 @@
<excludes>
felix.properties,
logback.xml,
logging.properties,
pipeline.properties
</excludes>
<mapper>
Expand All @@ -3332,6 +3339,11 @@
<src>src/main/resources/etc/logback.xml</src>
<dst>${deb.pipeline.config}/logback.xml</dst>
</data>
<data>
<type>file</type>
<src>src/main/resources/etc/logging.properties</src>
<dst>${deb.pipeline.config}/logging.properties</dst>
</data>
<data>
<type>link</type>
<symlink>true</symlink>
Expand Down
1 change: 1 addition & 0 deletions src/main/deb/DEBIAN/conffiles
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
${deb.pipeline.config}/logback.xml
${deb.pipeline.config}/logging.properties
/etc/default/daisy-pipeline2
1 change: 1 addition & 0 deletions src/main/resources/bin/pipeline2
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ run() {

# Logback configuration file
SYSTEM_PROPS="${SYSTEM_PROPS} -Dlogback.configurationFile=\"file:${PIPELINE2_CONFIG}/logback.xml\""
SYSTEM_PROPS="${SYSTEM_PROPS} -Djava.util.logging.config.file=${PIPELINE2_CONFIG}/logging.properties"

# to make ${org.daisy.pipeline.data} available in felix.properties (for felix.cache.rootdir)
if [ "$ENABLE_OSGI" = "true" ]; then
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/bin/pipeline2.bat
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ goto :RUN_LOOP

rem Logback configuration file
set SYSTEM_PROPS=%SYSTEM_PROPS% -Dlogback.configurationFile="file:%PIPELINE2_HOME:\=/%/etc/logback.xml"
set SYSTEM_PROPS=%SYSTEM_PROPS% -Djava.util.logging.config.file="%PIPELINE2_HOME:\=/%/etc/logging.properties"
rem to make ${org.daisy.pipeline.data} available in felix.properties (for felix.cache.rootdir)
if %ENABLE_OSGI% == true (
set SYSTEM_PROPS=%SYSTEM_PROPS% -Dorg.daisy.pipeline.data="%PIPELINE2_DATA%"
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/etc/logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
handlers= java.util.logging.ConsoleHandler
.level= FINE
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
org.restlet.level = SEVERE
com.sun.jna.level = INFO
sun.rmi.level = INFO

0 comments on commit ee47a85

Please sign in to comment.