I am building a Mulesoft/Anypoint app for deployment on Cloudhub, and for diagnostic purposes want to be able to determine (from within the app) whether it is running on Cloudhub or in Anypoint Studio on my local development machine:
- On Cloudhub, I want to use the Cloudhub connector to create notifications for exceptional situations - but using that connector locally causes an exception.
- On my local machine, I want to use very verbose logs with full dumping of the payload (
#[message.payloadAs(java.lang.String)]
) but want to use much more concise logging when on Cloudhub.
What's the best way to distinguish the current runtime? I can't figure out any automatic system properties that expose this information.
(I realize the I could set my own property called something like system.env=LOCAL
and override it with system.env=CLOUDHUB
for deployment, but I'm curious if the platform already provides this information in some way.)