diff --git a/contrib/cont-init.d/20-add-console-loggers b/contrib/cont-init.d/20-add-console-loggers new file mode 100644 index 00000000..810138e7 --- /dev/null +++ b/contrib/cont-init.d/20-add-console-loggers @@ -0,0 +1,10 @@ +#!/bin/bash + +CONFIG_FILE="${OPENHAB_USERDATA}/etc/log4j2.xml" +OSGI_AREF='' +STDOUT_AREF='' + +if [ "$(grep "${STDOUT_AREF}" "${CONFIG_FILE}" | wc -l)" == "1" ]; then + echo "Adding console loggers to ${CONFIG_FILE}" + sed -i "s#${OSGI_AREF}#${OSGI_AREF}\n\t\t\t${STDOUT_AREF}#g" "${CONFIG_FILE}" +fi