diff options
5 files changed, 146 insertions, 3 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"> diff --git a/ms_specific_connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java b/ms_specific_connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java index 46079ac5..5e7d92b2 100644 --- a/ms_specific_connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java +++ b/ms_specific_connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java @@ -234,7 +234,6 @@ public class FullStartUpAndProcessTest { szrMock = soap.mock(SZR.class, "http://localhost:1234/demoszr"); zmrClient = soap.mock(ServicePort.class, "http://localhost:1234/demozmr"); - cc = RandomStringUtils.randomAlphabetic(2).toUpperCase(); pseudonym = RandomStringUtils.randomNumeric(64); personalId = cc + "/AT/" + pseudonym; diff --git a/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/config/LoggerContextConfiguration.java b/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/config/LoggerContextConfiguration.java new file mode 100644 index 00000000..30312160 --- /dev/null +++ b/ms_specific_proxyservice/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 = "proxyservice"; + 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_proxyservice/src/main/resources/logback.xml b/ms_specific_proxyservice/src/main/resources/logback.xml index 9679d9e4..be87a170 100644 --- a/ms_specific_proxyservice/src/main/resources/logback.xml +++ b/ms_specific_proxyservice/src/main/resources/logback.xml @@ -8,6 +8,9 @@ <!-- 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> |