Search code examples
ibm-cloudopenwhisk

How do I configure and access logs in Java and Docker based OpenWhisk actions?


Looking at OpenWhisk samples, it seems like JavaScript-based actions can use console.log() to report log information that would be collected and accessible through the activation API.

However, it is not clear how to report logs from Java-based or Docker-based actions.


Solution

  • Logs for OpenWhisk actions are taken from stdout and stderr of the action. That mechanism applies to all runtimes.

    The Docker-based approach assumes that stdout of the program you run is the result of the action. Thus it takes stdout and tries to JSON-parse it. The result will be the result of the action itself rather than logs. Currently there is no way to write logs in a docker-based action.