The reason the arrayFormat method doesn't use the original exception's message is that there's no placeholder (i.e. "{}") for it in the message that it's formatting. However, the original exception message *is* preserved in the stack-trace because the "initCause" method is invoked with the original exception. Therefore, when the stack-trace of the returned exception is printed the original exception's message should be printed along with it.
If you want a simple way to get this message I suggest using ExceptionUtils.getRootCauseMessage from Apache's Commons Lang 3 [1]. Hope that helps! Justin [1] https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/exception/ExceptionUtils.html#getRootCauseMessage(java.lang.Throwable) On Tue, Aug 5, 2025 at 8:09 AM Vojtech Fric <vojtechf...@ibm.com.invalid> wrote: > Hi. > We are facing some issues with artemis-core-client in > org.apache.activemq.artemis.core.client.impl.ClientProducerImpl#largeMessageSendStreamed > we are hitting the IOException, but this IOException is not propagated to > the logs. > > The core issue lies in the following generated method: > > // @org.apache.activemq.artemis.logs.annotation.Message(id=219026, > value=\"Error reading the LargeMessageBody\") > @Override > public org.apache.activemq.artemis.api.core.ActiveMQLargeMessageException > errorReadingBody(java.lang.Exception e) { > String returnString = MessageFormatter.arrayFormat("AMQ219026: Error > reading the LargeMessageBody", new Object[]{e}).getMessage(); > > { > org.apache.activemq.artemis.api.core.ActiveMQLargeMessageException > objReturn_errorReadingBody = new > org.apache.activemq.artemis.api.core.ActiveMQLargeMessageException(returnString); > objReturn_errorReadingBody.initCause(e); > _copyStackTraceMinusOne(objReturn_errorReadingBody); > return objReturn_errorReadingBody; > } > } > > Due to the logic of the MessageFormatter.arrayFormat the original > exception is never logged. The formatter returns just AMQ219026: Error > reading the LargeMessageBody. > > Is there a way to get the original message to print? Also, is this > intentional or a bug? > > We are encoutering this on Artemis 2.40.0, but the source code is the same > in 2.42.0 as well > > > > > > Vojtěch Frič > > Software Engineer > > IBM Czech Republic > > E-mail: vojtechfric<vojtechf...@ibm.com>@ibm.com<vojtechf...@ibm.com> > > > > >