Hi,
I wanted to do some custom logging of the outgoing message. The
suggestion was to look into the class LoggingOutInterceptor. I made it
work but only with copy-paste-change.
How about we make a small change to the LoggingOutInterceptor making it
accept another argument in the constructor of type
LogMessageTransformer, which it can call prior to actually writing to
the log. This will help in case we just need to make some search and
replace like changes, e.g. masking sensitive information with X's.
Interface and modification is as follows.
//Interface
public interface LogMessageTransformer {
/**
* @param argMessageToBeTransformed incoming message to be
transformed
* @return transformedMessage
*/
public String transform(String argMessageToBeTransformed);
}
//change to the LoggingOutInterceptor.java
String logMessage=buffer.toString() ;
If(transformer!=null){
logMessage=transformer.transform(logMessage);
}
if (writer != null) {
writer.println(logMessage);
} else if (LOG.isLoggable(Level.INFO)) {
LOG.info(logMessage);
}
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete the material from any
computer.