Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
【Question】Regarding Log class
soseki
February 2019
Hello there,
I just recognised that if the batch is running over the days, Log dose not write correct log file.
For example, when the batch run from 1st of Jan 2018 until 3d of Jan 2018, all logs went to /2018/01/01.php.
Is that technically common?
Regards,
Harro
February 2019
Accepted Answer
There is no functionality to rotate the logfile name, it is determined when the log class loaded.
We generally use separate log files for tasks like that, so you get a log file per task run, instead of per day.
To do so, at the top of the run() method in your task:
// Switch to a custom logfile
$filename = date('c').DS.'-this-task-name.php';
\Config::set('log_file', $filename);
\Config::set('log_threshold', \Fuel::L_INFO);
// Reinitialize the log class
\Log::initialize();
logger(\Fuel::L_INFO, 'START - "this name" background task');
soseki
February 2019
Thanks for your help.
I always appreciate it
:)
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
February 2019
soseki
February 2019