From b3368514abe231894e1f47cddfd2f85cafdd94fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Oct 2023 09:13:27 +0200 Subject: [PATCH] NEW Add option MAIN_MAIL_DEBUG_LOG_WITH_DATE to add 1 log file per email --- htdocs/core/class/CMailFile.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 92acf87898a..e487e06c7cd 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1282,6 +1282,14 @@ class CMailFile fclose($fp); dolChmod($outputfile); + + // Move dolibarr_mail.log into a dolibarr_mail.YYYYMMDD.log + if (getDolGlobalString('MAIN_MAIL_DEBUG_LOG_WITH_DATE')) { + $destfile = $dolibarr_main_data_root."/dolibarr_mail.".dol_print_date(dol_now(), 'dayhourlog', 'gmt').".log"; + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_move($outputfile, $destfile, 0, 1, 0, 0); + } } }