How should I manage files that do not need to be retained?
Environment:
Oracle B2C Service
Resolution:
Store files in the ‘/tmp’ directory and if they are not updated in three days they will be deleted from the system.
Note: As of November 15th, 2024, this policy will be changed such that all files and folders in the /tmp directory will be deleted three days after their last updated timestamp
Oracle B2C Service has a folder on the file system that automatically removes files that have not been updated in three days. For example, store log files for your customizations in this location as they are not needed long term, but can be retained for three days in case there is need to troubleshoot something. Configure your systems to create new files each day to properly use this automated clean up. Do not append the same file indefinitely as it will not be cleaned up.
Sample code snippet:
file_put_contents("/tmp/logfile_".date('Y-m-d').".log","Hello World. This is a log!\n", FILE_APPEND);
The code line above will create one log file every day and append the contents to the existing logs file of respective day and then the system will remove the file three days later. For further details see
Answer ID 9897: Adding custom logging to your customizations
Please read about other data management best practices as well. Answer ID 10440: Data management is crucial to maximize Oracle B2C Service success