diff options
author | Thomas <> | 2021-09-15 08:45:55 +0200 |
---|---|---|
committer | Thomas <> | 2021-09-15 08:45:55 +0200 |
commit | c33ea092652c44301db770f1db4a7243eb6b2363 (patch) | |
tree | 41e1e2396fe3485712f1b33c8b9da18ee7ece3d8 /eidas_modules/authmodule-eIDAS-v2/src/main | |
parent | d139f1da33576c68c33772fc33dbdafb9616596e (diff) | |
download | National_eIDAS_Gateway-c33ea092652c44301db770f1db4a7243eb6b2363.tar.gz National_eIDAS_Gateway-c33ea092652c44301db770f1db4a7243eb6b2363.tar.bz2 National_eIDAS_Gateway-c33ea092652c44301db770f1db4a7243eb6b2363.zip |
optimize Apache CXF logging handler
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r-- | eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/LoggingHandler.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/LoggingHandler.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/LoggingHandler.java index 70290cd3..10acf3ad 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/LoggingHandler.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/LoggingHandler.java @@ -41,17 +41,23 @@ public class LoggingHandler implements SOAPHandler<SOAPMessageContext> { @Override public boolean handleMessage(SOAPMessageContext context) { - final SOAPMessage msg = context.getMessage(); - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); + // only perform operations if logging is on trace level + if (log.isTraceEnabled()) { + final SOAPMessage msg = context.getMessage(); + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); + final boolean request = ((Boolean) context + .get(SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY)).booleanValue(); + try { + msg.writeTo(bos); + log.trace("{} Web-Service with content: {}", + request ? "Requesting to" : "Response from", bos.toString("UTF-8")); - try { - msg.writeTo(bos); - log.trace(bos.toString("UTF-8")); - log.trace(new String(bos.toByteArray(), "UTF-8")); - - } catch (final Exception e) { - log.trace(e.getMessage(), e); + } catch (final Exception e) { + log.trace(e.getMessage(), e); + + } } + return true; } |