LaceySnr.com - Salesforce Development Posts by Matt Lacey

How To Identify a JavaScript Remoting Log in the Developer Console

Posted: 2016-02-17

These days it's not unlikely that you'll be using some kind of JavaScript remoting in your Visualforce pages in order to provide a better experience to users than the older Visualforce techniques offer (i.e. <apex:commandButton> etc. that send the entire page state back and forth).

It's also quite likely that you have a lot of such operations going on, and unless each individual one is manually triggered then matching a log in the backend to a a particular request can be pretty tricky. One option is to simply click on each log in the Developer Console and see what relative URL was being hit in each one, but that's not the best option, especially if you're somewhere like Australia where things aren't particularly fast.

Assuming you don't actually need the result of the request because you're actually interested in the inner workings of it rather than the outcome, then one easy way to make the request easy to spot in the log list is to make it fail.

Blow It Up

There's plenty of ways to make a request fail, but quite possibly the simplest is to make use of System.Assert:

System.Assert(false);

This will immediately stop execution of the method (so you probably want to place it at the end) and it will mark the request as a failure in the logs making it much easier to spot in a sea of successes.