1

I was working through Trailhead assignments that use console.log(); statements in Lightning code and spent a long time trying to figure out why they weren't showing up in the Developer Console logs.

1 Answer 1

5

Here's the secret. console.log() is a javascript-level function that outputs NOT to the force.com developer console Logs window (which is where Force.com calls like System.Debug show up) but to the browser developer console. So, for example, if you're building a Lightning App, after you click Preview in the Force.com Developer Console, and a new browser window opens up, you then need to open that new window's developer tools, from your Chrome or Safari or whatever, and click its "console" tab. Then any log statements your code generates during execution of javascript on that page will

This is probably really obvious to most engineers, but it's not well explained in any of the material designed for new Salesforce developers that I was able to find.

1
  • I've found that the browser console is absolutely essential for troubleshooting Lightning Components. Feb 18, 2017 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .