Newer Version Available

This content describes an older version of this product. View Latest

Warning Messages

To help debug your client-side code, you can use the warning() method to write output to the JavaScript console of your web browser.

Use the $A.warning(string) method to write a warning message to the JavaScript console. The parameter is the message to display.

For example, $A.warning("This is a warning message."); outputs to the JavaScript console.

1This is a warning message.

$A.warning() doesn't output by default for Lightning components, which run in either PROD or PRODDEBUG modes. To log warning messages in PROD or PRODDEBUG modes, use $A.logger.subscribe("WARNING", logCustom), where logCustom() is a custom function that you define. For more information, see Logging in Production Modes.

Note

For instructions on using the JavaScript console, refer to the instructions for your web browser.