Log to Standard Out in JS query (Self-hosted Retool)

  • Goal: I would like to log an error message to the Retool backend standard out on error events

For context, this is useful to me since I am running self-hosted Retool, so I can see and track the Retool backend logs.

I haven't been able to find a way to do this. Are there any ways to do this?

1 Like

Bump - could someone take a look if possible? thanks

Alternatively, I am curious if there is a code executor SDK I could use to programmatically interface with the Retool backend from my app?

Hey @pablo.estrada! Thanks for reaching out.

I can't think of a way to directly add output to the backend server logs. Nor does the code-executor have any public endpoints, as far as I know. :thinking: Most of the built-in features that come to mind are scoped to the Enterprise plan - observability integration and error event handling, specifically.

Is your org streaming and parsing server logs internally for the purpose of analytics? Is there a particular reason you're interested in connecting to the code-executor, in particular?

Yes, my org uses server logs internally for the purpose of analytics. I want to be able to log to the standard out from app queries. This seems to be possible using the analytics queries, so I wanted to use this same behavior for other queries (ex: JS queries)

Is there a particular reason you're interested in connecting to the code-executor, in particular?

I was interested if this was a possible alternative to log directly to be backend.

Makes sense! I'm pretty sure the analytics query is going to be your best bet, then. For your particular use case, would it work to define a single generic analytics query that you can then trigger via another query's failure handler? You can trigger it with additionalScope in order to dynamically pass in a payload that is relevant to the current error being handled.

I do like the idea of a built-in utility function that would make this easier, but I'm not sure how feasible it would be, given that its usefulness would be scoped entirely to the self-hosted product. It's probably worth bringing up to the team, though!