r/reactjs • u/Deb1Kk • Jun 26 '26
Needs Help Console not working
No messages appear in console. I know for a fact that the function with console.log() is called, because the states change, but no messages appear in console.
I have tried calling console.log() in all the ways I could think of, passing it inside click handlers to buttons, calling it in useEffect, both in and out of the main App.tsx component. No filter are active in DevTools, and the app is in development mode. What could cause this?
0
Upvotes
3
u/Quoth_The_Revan Jun 26 '26
Have you checked if something is overriding console.log? You can set it to do whatever you wanr, and I've seen people set it to an empty function in prod to prevent it from spamming logs. For example:
3
u/texas-shave-em Jun 26 '26
You've probably checued error or warning only. It's to the right of the filter box in console?
2
u/retro-mehl Jun 26 '26
Maybe SSR and the log is in your terminal window?
2
u/azangru Jun 26 '26
You might have opened the wrong url and might be looking at the wrong instance of the website? :-)
6
u/petyosi Jun 26 '26
Use the browser debugger to stop at a console log call, see if something looks weird. If still not solved, record your screen, interactions, and the console panel showing how you reproduce this.
1
u/justjooshing Jun 26 '26
Did it work before in this app? A previous workplace I worked at disabled it unless we used console=true query param. Is it elsewhere in the codebase?
1
u/octocode Jun 26 '26
did you try setting a breakpoint above the console log to see what is happening
1
u/cheese_wizard Jun 26 '26
Do you have something accidently in the dev tools console filter?
1
u/Johnathan3_ Jun 26 '26
Can you share the snippet of the code that is not working?
0
u/Deb1Kk Jun 27 '26
UPDATE: After inspecting the "Sources" tab of DevTools, I have noticed that some weird js file was generated, each time with a different name. Looking into it, it was tied to browser extensions, so I uninstalled everything I had, even though no new extensions have been installed, and the console fixed itself. Thanks everyone for suggestions