Skip Navigation
Expand
Using the /tmp Directory to Store Log Files
Answer ID 12194   |   Last Review Date 04/28/2022

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 seven days they will be deleted from the system.

Oracle B2C Service has a folder on the file system that automatically removes files that have not been updated in seven days.  For example, store log files for your customizations in this location as they are not needed long term, but can be retained for one week 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 seven 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