Option to prepend timestamp to stdout and stderr log file with config. Resolves #553#1407
Option to prepend timestamp to stdout and stderr log file with config. Resolves #553#1407the-c0d3r wants to merge 10 commits intoSupervisor:mainfrom
Conversation
…estamp. The tests are leaking open file descriptors, not sure why calling dispatcher.close() doesn't close them.
|
I was asked to review and merge this, but I don't really understand this subsystem enough to do that. However, I did test it anyway, and it seems to break |
|
Hi @mnaberez, may I ask what is the status with this PR? Could you please tell me how it breaks |
The timestamps are mixed into the output, making fg mode unusable. |
|
waiting |
|
Based on my testing with simple bash script and I do not see an issue with this, maybe you can elaborate more on this? |
I don't think most users would expect changing a logging option would cause unexpected output to be injected into fg mode. It would make using a lot of software under fg mode unusable. My opinion is that fg mode should probably work correctly regardless of which logging options are set. |
|
Hi community, thanks for the PR @the-c0d3r. I think it's a helpful feature, and we should solve the problem. Could you please explain how do you test the |
|
Hi @ZPascal, If you are looking for how to test the
#!/bin/bash
while true; do
echo "This is from test.sh $(date)";
sleep 1;
done;Run it as follows As for the status of this PR, somewhere on the #553 , it was mentioned that this PR will not close it, as it only prepend timestamp, but the issue #553 is about specifying the log format. I will find some time to work on it and push the change for a customised timestamp format soon. |
…ed new format variable "custime" for customised timestamp format.
|
I have pushed a change that will allow one to specify the format of the timestamp to prepend. Since "Supervisor uses Python string interpolation when parsing the config file" (quoting from #291), we have to escape the To the maintainer/reviewers, please let me know what else to be done for this PR to be merged. Thanks. |
As I indicated above, I don't think users will accept unexpected output being injected into People use Another thing that would have to be checked if is a patch like this would also interfere with the events system. There are events emitted for process log output and these must not have unexpected output mixed it. I was reading #553 (comment) and I believe the problem described in that comment may apply here as well. Depending on how/when the dispatcher flushes, the timestamp may not get added correctly. |
|
@the-c0d3r Thank you for the detailed explanation. |
|
Ok, when? |
This is to revive the PR #333 , but this time, I have added proper unit testing for the output dispatcher.
I retained all the original changes from the PR #333 and merged to current master, and added 2 new unit test functions and 4 new tests to the existing test function.
Let me know if the unit testing is insufficient, or is there anything else to change.
Related Issue: #553 Add ability to specify log format (6 years old issue)
Related PR: #1349 (closed due to lack of unit tests)
Credits to @nirmalc for the original code change.