A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/1942 below:

[apex] Add best practice rule for debug statements in Apex · Issue #1942 · pmd/pmd · GitHub

A good practice rule that might be missing from the existing ruleset is to warn about the usage of debug statements without specifying a logging level.

In Apex, developers can use System.debug('message'); to write relevant information to the logs, for debugging purposes. While useful while developing, it can be an issue in production code, where a class/method might run several times in a single transaction.

Fortunately, Salesforce allows us to filter Apex debug statements by its log level, if specified. So a developer can get a log with only warnings and errors, if the relevant statements in the code are written with the logging level parameter, as in:

System.debug(LoggingLevel.ERROR, 'Should not run this. Maybe the user forgot to add something to that field before trying this?');

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4