Send SC debug to log file

Can we have an option to save the debug data to a log file on disk?

Value should be a boolean, be target dependent and should be parseable from an $_ENV.variable

Hi. Are you suggesting this for server connect or for server action/API?

Yes, yes, yes,
this would be amazing.

I have a a server action run from a crontab, so directing the output to a file would be brilliant.

Server Connect. Server logs.

The naming is very confusing.
Server connect = panel on the left?
or Server connect = client side component?

Panel on the left.

This data.

When I use SC I refer to server/backend always, if I’m going to refer to right side panel I do it by AC SC component.

Thanks for clarifying.

It would be a great addition.
And, it would be even better if it works on all server models, and not just NodeJS.

1 Like

Standard debug outputs to stderr, on most servers this is captured and logged, so it should appear in the server logs.

Are you saying that there are already server logs we can use, if so where would I find them?

It depends on the server and how node is installed. Our server for example uses the plesk admin panel and that is logging all node output. It depends on the server implementation, but we could probably have some custom server logs instead.

What kind of logging would be required, just network requests from the server of all the urls requested or more generic logging of all console logs of node?

I would say something that doesn’t add too much overhead.

With pino maybe? It’s a bit more performant than debug and has a bit more flexibility.

Besides the implementation you could also pair it with a SC core action for console.log/console.error so we can add specific entries in the log.

A flag to activate it only in dev environments would also be nice.

I was thinking generic console logging statements into a file, this can then be tailed, and having ability to add our own debug statements, plus include wappler function debug. Meaning if server connect function has output on then stream this all sequentially to the log file. Of course you would never do this in production, but think it’s perfect to develop with.
Being new to Wappler and node js, am open to suggestions.

We mainly develop back-end apps and APIs with SC and it’s a real struggle to debug those.