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

feat: Add logging with tracing #1041

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: Add logging with tracing #1041

wants to merge 1 commit into from

Conversation

kdheepak
Copy link
Contributor

@kdheepak kdheepak commented Sep 6, 2024

This PR adds the setup for logging using the tracing module.

After init_logging is called, a log file will be created in one of these locations (per XDG standard):

image

or in a folder in the environment variable JULIAUP_DATA_HOME or in the current directory.

tracing::info! or tracing::debug! can be used to log into the log file.

Additionally, RUST_LOG environment variable can be used to control the logs for the various modules or dependencies.

@tecosaur
Copy link
Contributor

tecosaur commented Oct 4, 2024

This looks nice! I'd suggest that logs are more appropriate for the state dir, falling back on the data dir though.

image

https://docs.rs/directories/latest/directories/struct.ProjectDirs.html#method.state_dir

https://specifications.freedesktop.org/basedir-spec/latest/index.html#variables

@davidanthoff
Copy link
Collaborator

If we were to use those locations, then on Windows it should go into the AppData\Local not AppData\Roaming folder.

BUT, given that Julia generally has not adopted XDG at this point and has a standard log file location of .julia/logs we should just also put them there (ideally by checking the value of JULIAUP_DEPOT_PATH).

The other question I have is how does this handle concurrency? Generally, we need a solution where multiple processes all write logs at the same time. This here doesn't seem to handle that scenario?

And finally, this only adds the infrastructure, but never actually calls the init stuff, right? I think in general we probably want no logging by default but only opt into it via some configuration or something like that?

@tecosaur
Copy link
Contributor

tecosaur commented Oct 7, 2024

I can't say I really see a downside of on-by-default logging, it could be nice to have a record of what versions are installed/uninstalled.

How I wish Julia itself actually paid attention to platform standards instead of fighting them...

@davidanthoff
Copy link
Collaborator

Well, the really Windows native solution would be to use the platform logic infrastructure instead of log files. I'm pretty sure tracing has support for that. But at the end of the day I think it is easier if we just stick with the Julia convention here.

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.

3 participants