1

When using the log() function in DataWeave I have a few questions:

  1. How can I set a log level and log category so my logs are handled by log4j2 the same way as log messages from the Logger components in the Mule flow?

  2. How can I suppress logging the expression? If the expression result is very large (what if it is streaming data?) I might only want to log to first argument to log, and skip the actual DW expression evaluation.

aled
  • 21,330
  • 3
  • 27
  • 34
Ethan Port
  • 166
  • 8

1 Answers1

1
  1. There is no way to set the logging level with the log() function in DataWeave. As an alternative you could implement a custom function in a custom module in to log that allows to set levels.

  2. You could use the same custom function to implement some logic, however there is the generic problem of determining if a payload is big without fully consuming it. In any case DataWeave logging is meant to be used as a debugging tool and should not be used in production or for big payloads. The best practice is to avoid logging at all unless you need to debug an issue, and then remove the logging.

aled
  • 21,330
  • 3
  • 27
  • 34