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

Is there any way to create a symbolic link that always points to the newest log file? #1099

Open
balusch opened this issue Mar 4, 2024 · 1 comment
Labels
feature Request for adding a new feature

Comments

@balusch
Copy link

balusch commented Mar 4, 2024

Hello! Firstly, thank you guys for the great project. I've been using it in my production environment and it's very convenient.

But it is not that smooth while using the rotation, which creates massive log files and it's a bit cumbersome for me to access the newest one every time I search for an entry. More specifically, I have to find the one with the smallest mtime (yes, it could be done with the help of ls options) first, then enter the suffix of the target file since they all share the same prefix so that autocomplete won't work perfectly.

So I wonder whether there is any way to create a symbolic link that always points to the latest log file, just as what glog's SetLogSymlink does, to facilitate my search process. I've searched for the keyword symbolic link in the document but found nothing, so I come here for advice.

@Delgan
Copy link
Owner

Delgan commented Mar 30, 2024

Hi @balusch.

Interesting feature. As of today, it's not easily achievable.

What about using logger.add("filename.log", rotation="2 days")? This would ensure that the latest log is always accessible through "filename.log", while older ones will automatically have the date appended at the end (you can customize the format if you don't like the default one). It would avoid the need for a symlink.

@Delgan Delgan added the feature Request for adding a new feature label Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for adding a new feature
Projects
None yet
Development

No branches or pull requests

2 participants