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

Trying to use thread placeholder on Rolling File writer #428

Open
joao-ribeiro83 opened this issue Apr 3, 2023 · 3 comments
Open

Trying to use thread placeholder on Rolling File writer #428

joao-ribeiro83 opened this issue Apr 3, 2023 · 3 comments

Comments

@joao-ribeiro83
Copy link

joao-ribeiro83 commented Apr 3, 2023

I'm trying to use the following tinylog.properties with tinylog 2.6.1:

rolling file

writer = rolling file
writer.level = trace
writer.format = {date: HH:mm:ss.SSS}|{thread}|{class}-{method}:{line}-{level}: {message}
writer.file = logs/{date:yyyy}/{date:MM}/log_{date:yyyy-MM-dd}{thread}{count}.log
writer.latest = logs/latest_{thread}.log
writer.charset = UTF-8
writer.buffered = true
writer.policies = startup, daily: 00:00, size: 2mb
writer.convert = gzip
writingthread = true

But i'm getting the following error when ever I use thread placeholder on writer.file or/and writer.latest:

LOGGER ERROR: Failed creating service implementation 'org.tinylog.writers.RollingFileWriter' (java.lang.IllegalArgumentException: Invalid token 'thread' in 'logs{date:yyyy}{date:MM}\log_{date:yyyy-MM-dd}{pid}{thread}_{count}.log')

Is it a bug or I'm doing something wrong? I'm trying to do rolling file per thread.

Regards
João R.

@pmwmedia
Copy link
Member

pmwmedia commented Apr 3, 2023

This is a feature request. There is no thread placeholder for file paths.

Currently supported placeholders for file paths:
https://tinylog.org/v2/configuration/#rolling-file-writer

@joao-ribeiro83
Copy link
Author

joao-ribeiro83 commented Apr 3, 2023

I thought any placeholder was possible in any case!
Maybe on the documentation is better to specify what placeholders are possible in each writer type and method.

For my request, yes its a feature for debugging if the application has several identical threads to identify the thread whith the problem.

@pmwmedia
Copy link
Member

pmwmedia commented Apr 3, 2023

We have placeholder for log messages that can be used by every writer for formatting its log messages: https://tinylog.org/v2/configuration/#format-pattern

On the other hand, we have placeholder for file paths that can only be used by the rolling file writer: https://tinylog.org/v2/configuration/#rolling-file-writer

Ideas how to document the differences are welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants