Skip to content

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!

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