Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is console.log() not printing anything?

Tags:

meteor

Just getting started with Meteor, on Windows. Following the initial instructions, the automatically generated "Hello World" app is running on localhost. The text and button are there, but clicking it doesn't output anything to the console. However, replacing console.log() with alert() does show the text ("You pressed the button") in the pop-up window.

like image 477
dimfisch Avatar asked Jan 15 '13 20:01

dimfisch


3 Answers

the console.log() output is printed in the browser. but it gets cleared immediately if you are submitting a form or handling an event as the page automatically gets refreshed.

if you want it to work, 1.Use chrome browser 2. check "Preserve log" check box on the console. then you can see the log

like image 50
Ajay Kumar Avatar answered Oct 11 '22 12:10

Ajay Kumar


@dimfisch - I didn't see a console.log in your code snippet above. At any rate, I'm reiterating my comment as an answer:

Any console.log entries that are inside a Meteor.isServer block will by default NOT show up in the browser's console log. They'll show in the terminal from where you launched your app via the meteor command.

like image 42
TimDog Avatar answered Oct 11 '22 13:10

TimDog


For anyone coming by here and currently losing your mind: for me I had searched using the Filter textbox at the top of the console. If you forget to clear that, you wont see any of your logs that don't match the filter :)

like image 31
Jonathan Jules Avatar answered Oct 11 '22 12:10

Jonathan Jules