Mule: intercepting any kind of logging and adding messages to a list

Throughout my flows I have the "logger" component that writes important messages to the log. Mule itself is also outputting "INFO" and "ERROR" logging information that is important for another part of my application. Now, I would like to send all the log messages away to another application when the flow execution is finished. I am thinking the right way to do this is to create an interceptor, add the messages to a list set as a flow variable, and send it away at the end of the flow execution. But I would also like the logger.debug(), logger.info(), that I have in my custom component Java code to also be added to the list and sent away.

Would using an interceptor be the right way to do this?


ANSWERS:


You can configure a different appender in your log4j configuration for the application. This allows you to use JMS as appender.

Another option would be to use Mule server notifications to take into account only messages flowing through message processors:


I would try a simpler way rather, at the end of flow drop a message to a vm to read the log file, another flow would be listening to this vm endpoint and start reading the log. Keeping it in a separate flow will give us more control on the log file to read different type of messages.



 MORE:


 ? How to use mule requester for SFTP - Dynamic file name and path
 ? Change logging in the Mule
 ? Custom log file name in mule using log4j
 ? How do I change the default location for mule application log files?
 ? Mule log is not working if i use synch and asyn in same log4 file
 ? Mule - Dynamic Path - File component
 ? Select distinct DateTime properties from List<IDictionary<string,object>> using LINQ
 ? Select distinct DateTime properties from List<IDictionary<string,object>> using LINQ
 ? Select distinct DateTime properties from List<IDictionary<string,object>> using LINQ
 ? Using LINQ, is it possible to output a dynamic object from a Select statement? If so, how?