salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.44k stars 2.07k forks source link

Improved logging, richer stack traces - 7.14 #10342

Open pgorod opened 8 months ago

pgorod commented 8 months ago

NOTE: this is the redone version of a much older PR, #8640 which has a bunch of comments and code reviews, in case any one wants to check for historical reasons

Description, Motivation and Context

Adds some config_override.php options to get more information in the logs, specifically:

Documentation preview

https://pedro--suitedocs.netlify.app/developer/logging/#_advanced_logging_configuration

How To Test This

Please read the documentation linked above, there are many options.

An important part of the testing is confirming that nothing changes until we start putting options in config_override.php. This will make me more confident about putting the code out there :-)

For a simple run, you can test this by adding entries in your config_override.php such as these (all explained in the Docs page):

$sugar_config['show_log_trace'] = 'One2MBeanRelationship'; // use a boolean true for all; or a string as filter
$sugar_config['show_log_trace_with_eol'] = true;
$sugar_config['show_log_trace_overview'] = true;
$sugar_config['show_log_trace_trim'] = 500;
$sugar_config['show_log_trace_source'] = 1;

Answers to some valid concerns

  1. This is backwards compatible because it does not assume any config values to be there, always uses sensible defaults, and respects the previous meaning of $sugar_config['show_log_trace'].

  2. This code is complex, and some bug can have slipped by, but it only runs in the cases where you select log traces, so it's easy to turn off, and shouldn't affect production systems.

  3. Some of this code impacts performance (lots of string operations, more file activity) but it's always opt-in: the impact only occurs when you configure it to happen.

  4. This is accompanied with a warning in Documentation: using log traces with argument values might leave sensitive information in the system logs. Use it only temporarily for troubleshooting purposes; obfuscate the information before posting it online; double-check that your logs are only accessible to admins; delete the logs when finished troubleshooting.

Types of changes

Final checklist

SuiteBot commented 7 months ago

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/suite-crm-8-5-1-massive-log-spam-of-the-below-4-lines/91876/9

SuiteBot commented 6 months ago

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/how-to-remove-the-depreciated-mpdf-module/92166/6

SuiteBot commented 6 months ago

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/error-in-suitecrm8-editviewdefs-php-is-missing/92154/22

SuiteBot commented 3 months ago

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/there-is-no-action-in-quotes/93115/13