# Part 1 (Clean Install)
* in Web Browser:
# peform a clean install
# while on the `System Configuration` installation step confirm, that:
* the `Include Web Request data in "System Log"` setting is visible and is enabled
* the `Largest Web Request/Session Size, that will be saved in "System Log"` setting is visible and has `5MB` value
* disable the `Include Web Request data in "System Log"` setting
* set `5KB` in the `Largest Web Request/Session Size, that will be saved in "System Log"` setting
* proceed to the next step
* in the IDE:
# open the `/system/config.php` file
# confirm, that it has these lines:
```
lang=php
$_CONFIG['Misc']['SystemLogIncludeRequestData'] = '0';
$_CONFIG['Misc']['SystemLogRequestDataLimit'] = '5KB';
```
# Part 2 (Upgrade)
* in Web Browser:
# upgrade from any previous In-Portal version (e.g. In-Portal 5.2.2-B1)
# while on the `System Configuration` installation step confirm, that:
* the `Include Web Request data in "System Log"` setting is visible and is enabled
* the `Largest Web Request/Session Size, that will be saved in "System Log"` setting is visible and has `5MB` value
* disable the `Include Web Request data in "System Log"` setting
* set `5KB` in the `Largest Web Request/Session Size, that will be saved in "System Log"` setting
* proceed to the next step
* in the IDE:
# open the `/system/config.php` file
# confirm, that it has these lines:
```
lang=php
$_CONFIG['Misc']['SystemLogIncludeRequestData'] = '0';
$_CONFIG['Misc']['SystemLogRequestDataLimit'] = '5KB';
```
* in Web Browser:
# login to Admin Console
# go to the {nav Configuration > Website > Advanced} section
# confirm, that:
* the `Keep Request Data in "System Log" for` system setting is present
* has value of `1 month` set in the dropdown
# Part 3 (Setting change)
# login to Admin Console
# go to the {nav Configuration > Website > Advanced} section
# confirm, that:
* the `Keep Request Data in "System Log" for` system setting is present
* has value of `1 month` set in the dropdown
# set value for the `Keep "System Log" for` system setting to `1 month`
# set value for the `Keep Request Data in "System Log" for` system setting to `2 weeks`
# save changes
# confirm, that changes were saved
# set value for the `Keep Request Data in "System Log" for` system setting to `3 months`
# save changes
# confirm, that changes were not saved and the error message was shown
# Part 4 (Adding Fixtures)
* in IDE
1. open the `` file for editing
2. add this code at the beginning of the `\UsersEventHandler::SetCustomQuery` method:
```
lang=php
$log = $this->Application->log('test message (default request/session data)', 123);
$log->setLogLevel(kLogger::LL_ERROR);
$log->write();
$log = $this->Application->log('test message (force add request data)', 124);
$log->setLogLevel(kLogger::LL_ERROR);
$log->addRequestData();
$log->write();
$log = $this->Application->log('test message (force remove request data)', 125);
$log->setLogLevel(kLogger::LL_ERROR);
$log->removeRequestData();
$log->write();
$log = $this->Application->log('test message (force add session data)', 126);
$log->setLogLevel(kLogger::LL_ERROR);
$log->addSessionData();
$log->write();
$log = $this->Application->log('test message (force remove session data)', 127);
$log->setLogLevel(kLogger::LL_ERROR);
$log->removeRequestData();
$log->write();
```
# Part 5 (Auto Logging Disabled)
* in IDE:
# open the `/system/config.php` file
# change `SystemLogIncludeRequestData` setting to `0`
# change `SystemLogRequestDataLimit` setting to `5KB`
# save changes
* in the Admin Console:
# go to the {nav User Management > Users} section
# go to the {nav Logs & Reports > System Log} section
# confirm, that among 5 newly created records with following properties:
* message: `test message (default request/session data)` + no request data + no session data
* message: `test message (force add request data)` + request data + no session data
* message: `test message (force remove request data)` + no request data + no session data
* message: `test message (force add session data)` + no request data + session data
* message: `test message (force remove session data)` + no request data + no session data
# Part 6 (Auto Logging Without Limits)
* in IDE:
# open the `/system/config.php` file
# change `SystemLogIncludeRequestData` setting to `1`
# change `SystemLogRequestDataLimit` setting to `5MB`
# save changes
* in the Admin Console:
# go to the {nav User Management > Users} section
# go to the {nav Logs & Reports > System Log} section
# confirm, that among 5 newly created records with following properties:
* message: `test message (default request/session data)` + request data + session data
* message: `test message (force add request data)` + request data + session data
* message: `test message (force remove request data)` + no request data + session data
* message: `test message (force add session data)` + request data + session data
* message: `test message (force remove session data)` + request data + no session data
# Part 7 (Auto Logging With Limit)
* in IDE:
# open the `/system/config.php` file
# change `SystemLogIncludeRequestData` setting to `1`
# change `SystemLogRequestDataLimit` setting to `1500`
# save changes
* in the Admin Console:
# go to the {nav User Management > Users} section
# go to the {nav Logs & Reports > System Log} section
# this is cut off message format (used below): `The %d bytes (%d elements) of data not logged, because it is larger, than %d bytes limit.`
# confirm, that among 5 newly created records with following properties (when data is logged, then at least 1 of the request data/session data must have `system-log-error` array key with the cut off message similar to the above-shown):
* message: `test message (default request/session data)` + request data + session data
* message: `test message (force add request data)` + request data + session data
* message: `test message (force remove request data)` + no request data + session data
* message: `test message (force add session data)` + request data + session data
* message: `test message (force remove session data)` + request data + no session data
# Part 8 (Rotation)
* in the database:
# open `SystemLog` table for editing
# pick any 2 records, that have both request data & session data present
# for 1 of the above records change `LogTimestamp` to be `above 1 week from now on` (the `strtotime('-2 weeks');` PHP code will produce that timestamp)
* in the Admin Console:
# go to the {nav Logs & Reports > System Log} section
# open 2 above-picked system log record for editing
# confirm, that they both have request data & session data
# go to the {nav Configuration > Website > Advanced} section
# set the `Keep Request Data in "System Log" for` system setting to the `1 week`
# save changes
# go to the {nav Configuration > Website > Scheduled Tasks} section
# confirm, that the scheduled task with `rotate_system_log_request_data` name is present
# run the scheduled task with `rotate_system_log_request_data` name is present
# go to the {nav Logs & Reports > System Log} section
# confirm, that from 2 above-picked records:
* record with newer `LogTimestamp` retained it's request data & session data
* record with patched `LogTimestamp` lost it's request data & session data
# Part 9 (CLI not logged)
* in IDE:
1. open the `/system/config.php` file
2. change `SystemLogIncludeRequestData` setting to `1`
3. change `SystemLogRequestDataLimit` setting to `5MB`
4. save changes
5. open the `/tools/cron.php` file
6. replace the `$application->EventManager->runScheduledTasks(true);` line with the
```
lang=php
$log = $application->log('test message (default request/session data + cron)', 221);
$log->setLogLevel(kLogger::LL_ERROR);
$log->write();
```
7. save changes
* in CLI:
# run the `php tools/cron.php`
* in the Admin Console:
# go to the {nav Logs & Reports > System Log} section
# confirm, that system log record with `test message (default request/session data + cron)` message was created
# confirm, that the above record don't have (even empty array) request & session data present