In the last post I showed how to log SOAP messages with JAX-WS and SLF4J. The solution is simple and straight forward, but it logs the entire message. This can be a problem if the message is large, either because the XML has a lot of nodes or the message contains large data in some of the nodes. In this post I focus on the latter one. Often binary data such as documents, images or any other type of data are transferred as Base64 encoded strings. Such data can be relatively large and encoded using Base64 it gets one third (1/3 or 33%) bigger. For instance if you transfer a document that is 1 MB large, it will be 1.3 MB encoded in Base64. Logging large data has multiple drawbacks. It may affect application performance, especially when messages become big and logging is done using synchronous appenders Readability of messages in the log file suffer. In most cases not the binary is of interest to analyze bugs and the like but the other data is Log files grow very fast and consume disk space or due to maximum log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// spdlog Copyright(c) 2015-2018 Gabi Melman, see https://github.com/gabime/spdlog | |
// this is a simple lazy variant of https://github.com/gabime/spdlog/blob/v1.x/include/spdlog/sinks/basic_file_sink.h | |
// | |
#pragma once | |
#ifndef SPDLOG_H | |
#include "spdlog/spdlog.h" | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ch.claudegex.examples.jaxws; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.util.Collections; | |
import java.util.Set; | |
import javax.xml.namespace.QName; | |
import javax.xml.soap.SOAPException; | |
import javax.xml.ws.handler.MessageContext; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<NotepadPlus> | |
<UserLang name="OmniMark" ext="ARG XAR XIN XMD XOM XOP"> | |
<Settings> | |
<Global caseIgnored="yes" escapeChar="%" /> | |
<TreatAsSymbol comment="no" commentLine="yes" /> | |
<Prefix words1="no" words2="no" words3="no" words4="no" /> | |
</Settings> | |
<KeywordLists> | |
<Keywords name="Delimiters">"'0"'0</Keywords> | |
<Keywords name="Folder+"></Keywords> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDate; | |
import java.time.YearMonth; | |
public class LocalDateRange { | |
private final LocalDate start; | |
private final LocalDate end; | |
public LocalDateRange(final LocalDate start, final LocalDate end) { | |
if(start == null) { | |
throw new IllegalArgumentException("Start date mustn't be null. Use LocalDate.MIN to represent no limit"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigDecimal; | |
import java.math.RoundingMode; | |
import java.text.DecimalFormat; | |
import java.text.DecimalFormatSymbols; | |
import java.text.ParsePosition; | |
import java.util.Objects; | |
public class Prozentsatz { | |
private static final BigDecimal HUNDERT = BigDecimal.valueOf(100); | |
private static final String DECIMAL_FORMAT_PATTERN = "###,###,##0.##########"; |