Spring uses a MessageSource
to retrieve the messages so one solution could be to write your own MessageSource
that encapsulate the Spring one and overwrite the getMessage
methods to insert your logging.
Something like the following (not tested):
<bean id="messageSource" class="com.acme.LoggingMessageSource">
<property name="pathtru">
<bean class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>buttons</value>
<value>labels</value>
</list>
</property>
</bean>
</property>
</bean>
with the class:
public class LoggingMessageSource implements MessageSource {
private MessageSource pathtru;
public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
// ...
}
public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
// ...
}
public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
// ...
}
}
I don't know if some methods are calling the other ones so you will have to experiment a bit.