Q) How can I do logging that is visible via the Apigee UI? I found this
https://community.apigee.com/questions/15605/what-is-the-best-way-to-log-messages-from-javascri.html
where for JavaScript is said: "Keep in mind you can call print() from within a JS callout. This shows up in the Trace window. Near the bottom you can find the "Output from all transactions". Can I print to "Output from all transactions" in Java Callouts too somehow?
No, today it is not possible to do that from within a Java Callout.
Instead you can populate Context variables with various state information.