question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with Rolling File Writer behavior

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
winooxxcommented, 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.

1reaction
pmwmediacommented, Aug 4, 2019

You can find the reasons for the change here: https://github.com/pmwmedia/tinylog/issues/103#issuecomment-495292048

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with Rolling File Writer behavior · Issue #116 - GitHub
Hi there, I have an Issue with the Rolling File Write behavior. In Tinylog 1.x the files get created by this schema if...
Read more >
Behavior changes in log4j 2.x - IBM
When this error occurs, the old log file is given a new name, and the existing one is overwritten. However, if there is...
Read more >
log4j RollingFileAppender not writing to log until application ...
In my experience, this could very well just be your OS/filesystem/storage appliance/etc issue, or the application your using to view the file size, ......
Read more >
Configuration - tinylog 2
The rolling file writer writes log entries to rolling log files. The log file can be defined as a pattern that will be...
Read more >
[#LOG4J2-3317] After 2.17.1 upgarde, Route appenders with ...
When I check output file, its not writing the logs to Route File what we specify but general RollingFile logger appenders are working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found