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

Added logging root directory #190

Merged
merged 2 commits into from
Dec 4, 2024
Merged

Added logging root directory #190

merged 2 commits into from
Dec 4, 2024

Conversation

neshdev
Copy link
Member

@neshdev neshdev commented Dec 4, 2024

Provides workaround for issue: #137

BUG=b/382252531

@neshdev neshdev requested review from a team and dolaameng December 4, 2024 16:31
@@ -35,7 +38,8 @@ def _configure_logger(log_dir: Optional[Path] = None) -> None:
handler = library_logger.handlers.pop()
while handler.filters:
handler.filters.pop()
log_dir = Path.home() / ".kaggle" / "logs" if log_dir is None else log_dir
log_root_dir = Path(os.environ.get(KAGGLE_LOGGING_ROOT_DIR_ENV_VAR_NAME, Path.home()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for working on the fix. Correct me if I am wrong:

I think the user mentioned (#137) that Path.home() might throw exceptions during "import", and using an env variable might be more complicated.

In that case, do you think it's simpler to use some standard ways such as /var/log or /tmp?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unix style paths aren't available on windows which are a subset of our users.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we start customizing the logic based on os, we would end up building something like Path.home()

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Probably makes sense to try and except and disable the logging if Path.home or /var/log doesn't work at all.

And +1 to make it opt-in as @rosbo mentioned below.

@rosbo
Copy link
Contributor

rosbo commented Dec 4, 2024

Should logging to a file be disabled by default? And we could add an environment variable to opt-in?

You really only need to look at these logs if you are facing an issue and need to debug it.

@neshdev
Copy link
Member Author

neshdev commented Dec 4, 2024

Should logging to a file be disabled by default? And we could add an environment variable to opt-in?

You really only need to look at these logs if you are facing an issue and need to debug it.

Made file logging optional.

@neshdev neshdev requested review from rosbo and dolaameng December 4, 2024 21:23
Copy link
Contributor

@rosbo rosbo left a comment

Choose a reason for hiding this comment

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

Thanks

@neshdev neshdev merged commit b830394 into main Dec 4, 2024
6 checks passed
@neshdev neshdev deleted the neshdev-logdir branch December 4, 2024 23:12
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