diff options
author | Thomas <> | 2023-12-07 16:00:31 +0100 |
---|---|---|
committer | Thomas <> | 2023-12-07 16:00:31 +0100 |
commit | 9b2f0b9308937d8d1b35fd2644e57dfb3b6e0ef3 (patch) | |
tree | ba14fec5c5df24a18379427fcfa16adca56b993e /ms_specific_connector/src/main | |
parent | 3af746e70a157c2f9d46a81f35167dd00e74bd53 (diff) | |
download | National_eIDAS_Gateway-9b2f0b9308937d8d1b35fd2644e57dfb3b6e0ef3.tar.gz National_eIDAS_Gateway-9b2f0b9308937d8d1b35fd2644e57dfb3b6e0ef3.tar.bz2 National_eIDAS_Gateway-9b2f0b9308937d8d1b35fd2644e57dfb3b6e0ef3.zip |
feat(core): add LoggerContextConfiguration to set application name as logger context parameter
Reason: can be used to separte configuration files in case of Connector and Proxy-Service run in same application server
Diffstat (limited to 'ms_specific_connector/src/main')
-rw-r--r-- | ms_specific_connector/src/main/java/at/asitplus/eidas/specific/config/LoggerContextConfiguration.java | 69 | ||||
-rw-r--r-- | ms_specific_connector/src/main/resources/logback.xml | 7 |
2 files changed, 74 insertions, 2 deletions
diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/config/LoggerContextConfiguration.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/config/LoggerContextConfiguration.java new file mode 100644 index 00000000..545a9703 --- /dev/null +++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/config/LoggerContextConfiguration.java @@ -0,0 +1,69 @@ +package at.asitplus.eidas.specific.config; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.spi.LoggerContextListener; +import ch.qos.logback.core.Context; +import ch.qos.logback.core.spi.ContextAwareBase; +import ch.qos.logback.core.spi.LifeCycle; + +public class LoggerContextConfiguration extends ContextAwareBase implements LoggerContextListener, LifeCycle { + + private static final String APPLICATION_IDENITIFER = "connector"; + private static final String LOGBACK_PARAM = "appId"; + + private boolean started = false; + + @Override + public void start() { + if (!started) { + Context context = getContext(); + context.putProperty(LOGBACK_PARAM, APPLICATION_IDENITIFER); + started = true; + + } + } + + @Override + public void stop() { + // TODO Auto-generated method stub + + } + + @Override + public boolean isStarted() { + return started; + + } + + @Override + public boolean isResetResistant() { + return true; + } + + @Override + public void onStart(LoggerContext context) { + // TODO Auto-generated method stub + + } + + @Override + public void onReset(LoggerContext context) { + // TODO Auto-generated method stub + + } + + @Override + public void onStop(LoggerContext context) { + // TODO Auto-generated method stub + + } + + @Override + public void onLevelChange(Logger logger, Level level) { + // TODO Auto-generated method stub + + } + +} diff --git a/ms_specific_connector/src/main/resources/logback.xml b/ms_specific_connector/src/main/resources/logback.xml index 9679d9e4..0919ce41 100644 --- a/ms_specific_connector/src/main/resources/logback.xml +++ b/ms_specific_connector/src/main/resources/logback.xml @@ -8,20 +8,23 @@ <!-- http://www.qos.ch/shop/products/professionalSupport --> <!-- --> <configuration> + + <contextListener class="at.asitplus.eidas.specific.config.LoggerContextConfiguration"/> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n</pattern> </encoder> </appender> + <logger name="at.gv.egiz.eaaf" level="info"> <appender-ref ref="console" /> </logger> <logger name="eu.eidas" additivity="false" level="info"> <appender-ref ref="console" /> </logger> - <logger name="at.gv.egiz.eidas.specific" additivity="false" - level="info"> + <logger name="at.gv.egiz.eidas.specific" additivity="false" level="info"> <appender-ref ref="console" /> </logger> <root level="info"> |