You can log console messages in your backend code

You debug your client-side code using the developer tools of your browser, like you would debug any modern JavaScript web-based application.

To debug your backend code, you can log console messages on the backend and they will appear in the Developer Console when you preview your site.

Read more about testing and debugging your Wix Code site here .

h/t to Andreas for the suggested post.

I am doing console.log(“bla bla I love WIX”); in the functions.js and I know the code above and below gets executed but I can’t see the console.log message in preview mode when testing. I might be tired but please bare with me and thanks for mentioning me :slight_smile:

Hi Andreas,

So, this same functionality isn’t available from the functions.js file because those functions don’t interact with the browser at all. They are functions you can provide to another user to access the functionality in your site. To accomplish what you want you would need to assign the message to a variable and pass that variable as part of the body of the HTTP message.

Yes I thought that was the case. I just created a small databased AppLog system where I can track and write stuff. To bad the err message object don’t contain row where error did come from before ending up in the catch statement. Would save a lot of time, but I will keep on hacking.

Hi @jeff-wix , Is this the same with events.js? So I won’t be able to see console.log() messages in preview?
Thanks,
Tom

If I log something on the backend will it appear on client-side browser?
I’m thinking about logging ‘confidential’ information but that I’ll be able to only see on the site monitoring. Is it safe?

If you are logging in the backend, it will be displayed in the Editor’s Developers Console due to some crazy magic by the Corvid developers. However, when running a Live site, the backend messages won’t appear in the browser’s console. See the doc section Backend Code & HTTP Functions where it states:
Because of security concerns, messages in backend code are not logged to the browser’s console on the published version of your site.

You can also use the Site Monitoring feature, to let you debug your published backend code. Site Monitoring is much more powerful and robust, and secure.