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

Problem with Rolling File Writer behavior #116

Closed
Cyb0rk opened this issue Aug 3, 2019 · 5 comments
Closed

Problem with Rolling File Writer behavior #116

Cyb0rk opened this issue Aug 3, 2019 · 5 comments

Comments

@Cyb0rk
Copy link

Cyb0rk commented Aug 3, 2019

Hi there,

I have an Issue with the Rolling File Write behavior.

In Tinylog 1.x the files get created by this schema if I setup 10MB filesize and 10 backups:

logfile.txt
logfile.1.txt
logfile.2.txt
[...]
logfile.10.txt

Tinylog 2.x creates the files via the following schema with the same settings:

logfile.0.txt (deleted)
logfile.1.txt (deleted)
logfile.2.txt (deleted)
[...]
logfile.50.txt (deleted)
logfile.51.txt
[...]
logfile.60.txt

In Tinylog 1.x I use this settings:

Configurator.defaultConfig()
  .formatPattern("{date:yyyy-MM-dd HH:mm:ss} [{thread}] {class}.{method}()\\t{level}: {message}")
  .writer(new RollingFileWriter("logs/aster_log.txt", 10, new CountLabeler(), new SizePolicy(10000 * 1024)))
  .activate();

in Tinylog 2.x I use this settings:

writer          = rolling file
writer.format   = {date:yyyy-MM-dd HH:mm:ss} [{thread}] {class}.{method} {level}: {message}
writer.file     = logs/APPNAME_log.{count}.txt
writer.charset  = UTF-8
writer.policies = size: 10mb
writer.backups  = 10

Could it be possible to change to 1.X behavior? This seems to be a more compatible option to Linux logrotate and is way more logical.

@pmwmedia
Copy link
Member

pmwmedia commented Aug 4, 2019

You can find the reasons for the change here: #103 (comment)

However, I could imagine to make the count placeholder configurable to get the old behavior if really needed.

@Cyb0rk
Copy link
Author

Cyb0rk commented Aug 5, 2019

Hello there,

if you could add a switch like "logrotate behavior" that would be greate. Otherwise I'll just switch to rotate logfiles via logrotate.

But I won't switch from tinylog to any other library. Tinylog is really great and with its small footprint and simple configuration it fits all of my needs :)

Great job with tinylog!

@winooxx
Copy link

winooxx commented Nov 12, 2019

The backup naming behaviour that TinyLog v1 does is far more intuitive than v2, I agree with #116( issue comment ). TinyLog is really simple enough to use and fits all my needs, except this little change on v2 :). Thank you for creating such a great logging framework.

@pmwmedia
Copy link
Member

pmwmedia commented Aug 19, 2020

Close in favor of #149

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

This closed issue has been locked automatically. However, please feel free to file a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants