-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs in saved messages are duplicated #264
Comments
I couldn't reproduce this on
|
Must be related to the way it captures logs/output. Injector::inst()->get(LoggerInterface::class)->error("(LOGGER) RUNNING PROCESS STEP {$this->currentStep})");
echo("(ECHO) RUNNING PROCESS STEP {$this->currentStep}");
sleep(1);
$t = microtime(true);
Injector::inst()->get(LoggerInterface::class)->error("(LOGGER) DONE STEP {$this->currentStep} AT T: {$t}");
echo ("(ECHO)DONE STEP {$this->currentStep} AT T: {$t}"); It seems that anything echo'd or logged gets captured in the QueuejobDescriptor messages straight away, but then some later time it also re-adds those messages captured by the logger (multiple times if process is called multiple times). See the latest example code.
I tried both with default and doorman (assuming it would work on mac with the suggested config/as seen in the example?) |
Thanks for the new information. Echo and log are essentially the same in this case. I suggest to use the You can add this to your
and add this to your job:
Please post the output of I also recommend running the test on latest |
Output from your suggestion:
So yeah it must be something to do with the (default?) configuration of how the LoggerInterface works, as it's only that which seems to have the issue of being captured multiple times. |
Right, the job execution looks fine, it's indeed some issue with logging. I recommend inspecting which loggers / handlers you have registered when executing the job. I also suggest to inspect job messages because some of the logs are stored in there. |
I do encounter the same issue when using 4.6.0 (without Doorman). |
I assume that the issue is due to the BufferHandler that wraps the QueuedJobHandler, this check is not working properly and adds a QueuedJobHandler per iteration. |
Logs now seem to get captured multiple times within a job's saved messages, if process is called more than once i.e. if there are more than 1 steps to run.
For example, a simple QueuedJob that has 3 steps and writes logs in each step:
This seems to log each step correctly (0-2), but then repeats logging step 1 and 2, then again repeats logging for step 2.
Output:
Not sure what the cause is, possibly related to the changes in flushing in #242 ?
An example repo with this simple test case can be found here.
Versions seen in:
symbiote/silverstripe-queuedjobs 4.4.0
The text was updated successfully, but these errors were encountered: