camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siano, Stephan" <>
Subject Somewhat inconsistent behaviour for message logging
Date Thu, 27 Nov 2014 13:34:57 GMT

I have looked into the coding for the logging of the payload in different locations of the
Camel coding, but it looks somewhat inconsistent to me.

In several places MessageHelper.extractBodyForLogging(Message) or MessageHelper.extractBodyForLogging(Message,
String) is used to get a payload formatted for logging (e.g. in the DefaultMessage.toString()
method). In that case the logged message body will be truncated to the length of the Exchange.LOG_DEBUG_BODY_MAX_CHARS
exchange property or to 1000 characters if this is not set.

The DefaultExchangeFormatter (that is e.g. used in the log endpoint and the DefaultErrorHandler)
has a setter for maxChars and uses the value set there or a default of 10000 characters when
calling the MessageHelper.extractBodyForLogging(Message, String, boolean, boolean, int) method.
IMO this makes some sense for the log endpoint, where the maxChars parameter of the DefaultExchangeFormatter
is set from the endpoint parameter, but it makes it very hard to properly configure this for
the DefaultErrorHandler.

Is this desired?

Wouldn't it be better if the DefaultExchangeFormatter would also honor the Exchange.LOG_DEBUG_BODY_MAX_CHARS?

The question would be what would take precedence, the parameter or the property in case both
are set.

If this makes sense, I could provide an extension to the DefaultExchangeFormatter for this.

Best regards

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message