Skip to content
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

uftrace: Improve logfile creation location #1971

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dlgus8648
Copy link

@dlgus8648 dlgus8648 commented Sep 12, 2024

uftrace: Improve logfile creation location

Ensure that when using "--logfile=", the logfile is created
inside the uftrace.data directory.

Additionally, when using both "--host" and "--logfile" options simultaneously
on the clinet, the logfile in the uftrace.data directory is sent to the host.

Fixed: #831

@dlgus8648 dlgus8648 changed the title Signed-off-by: Rihyeon Kim <[email protected]> uftrace: Improve logfile creation location Sep 12, 2024
@gichoel
Copy link
Contributor

gichoel commented Sep 12, 2024

Thanks for your contribution to fix this issue.

However, we can see that the title part has a signature in it, and this line needs to be removed so that the original intended title can be uploaded.

In addition, we can see that the title is uftrace: Improve logfile creation location, but this work is more like moving rather than improving the creation location, so how about changing it to uftrace: Move logfile path to uftrace.data?

Ensure that when using "--logfile=<name>", the logfile is created
inside the uftrace.data directory.

Additionally, when using both "--host" and "--logfile" options
simultaneously on the client, the logfile in the uftrace.data
directory is sent to the host.

Fixed: namhyung#831

Signed-off-by: Rihyeon Kim <[email protected]>
@dlgus8648
Copy link
Author

It seems that the title recommended by gicheol is more appropriate.
I have updated the title.

Thank you!

@@ -1474,7 +1474,16 @@ int main(int argc, char *argv[])
debug = 1;

if (opts.logfile) {
logfp = fopen(opts.logfile, "a");
char *logfile_path = NULL;
if (create_directory(opts.dirname) < 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. Creating directory includes renaming the existing directory. This can be a problem either you create a new one for record or dealing with an existing one for replay.

Ensure that when using "--logfile=<name>", the logfile is created
inside the uftrace.data directory.

Additionally, when using both "--host" and "--logfile" options
simultaneously on the client, the logfile in the uftrace.data
directory is sent to the host.

Fixed: namhyung#831

Signed-off-by: Rihyeon Kim <[email protected]>
@dlgus8648
Copy link
Author

I understood @namhyung 's comment to mean that calling the create_directory() function at that point could potentially cause issues elsewhere.
Therefore, I moved the logic for creating the logfile in the uftrace.data directory to the point when the uftrace terminates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logfile enhancement
3 participants