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

tail -f no longer updates after the log is rotated #397

Open
andrewchen5678 opened this issue Oct 19, 2024 · 0 comments
Open

tail -f no longer updates after the log is rotated #397

andrewchen5678 opened this issue Oct 19, 2024 · 0 comments

Comments

@andrewchen5678
Copy link

andrewchen5678 commented Oct 19, 2024

When I am trying this configuration with log4rs 1.3.0 with tail -f logs/test.log on a separate terminal, the tail command stops updating after log rotation, I think I have encountered this before in some other setups and it seem to have something to do with the file descriptor got changed or didn't change, or log rotation is not implemented with truncating logs/test.log in place instead. I wonder what it is causing it or there is a setting to make it work like apache's rotatelog utils.

for other use cases when I pipe the log to apache's rotatelogs like this, rotatelogs -n 5 logs/test.log 1M, tail -f continues to receive logs after rotation.

Not sure which behavior is industry standard. I have worked with python before and I don't remember if python allows you to specify rotatelogs behavior. For the mean time I just workaround by using tail -F instead.

appenders:
  file_rs:
    kind: rolling_file
    path: "logs/test.log"
    append: false
    #encoder:
    #  pattern: "{d} - {l} - {m}{n}"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 1mb
      roller:
        kind: fixed_window
        base: 1
        count: 5
        pattern: "logs/test.{}.log"


root:
  level: info
  appenders:
    - file_rs
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

No branches or pull requests

3 participants
@andrewchen5678 and others