Frage

I am trying to implement logging in mule and have a basic question.

My services are all configured to run on a tomcat server and not on Mule. I am only using Mule for orchestration.

Should I use interceptors or a logger component? As far as I can see, Interceptors are being used with CXF service and simple service definitions. But my services are not in Mule.

I am using Proxy service and client to call the external services.

Questions:

  1. As far as I understand, using CXF Interceptors for logging is useful when testing, but is it the proper way to log messages in Mule?

  2. Is it ok to have interceptors with Proxy service and client?

War es hilfreich?

Lösung

I would prefer using <logger /> instead of <logging-interceptor /> because logger has plenty of configurable options that allow you to log exactly what you want (message expression), where you want (category) and at the level you want (INFO, ...).

Andere Tipps

Assuming you want to log the in/out requests in full:

1) Use the CXF interceptors as they will also capture invalid requests, which is very useful for tracking errors.

2) Yes.

David here has a valid point that the logger is more flexible, if you find yourself wanting more than the default logging, write your own or extend the existing interceptors. See this example (written by me).

logging interceptor may not visible in your flows which executes on backed on same thread of the flow.

using the log component in flow, it will be visible in flow and can write plenty of mel based on requirement

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top