Closed gliptak closed 7 years ago
Looking through the file output writers an idea that strikes me is to write a new OutputWriter
called simply FileOutputWriter
and making it a bit more generic. This writer could support both use cases that we have in the two different writers now. Then we could also add pattern support for how the results would be written, allowing us to create a pattern that writes each collection to a single line as in your use case.
Then we could deprecate the two existing file writers and refactor them to just delegate to the new generic one with behavior kept.
Thoughts on this idea?
So would you like to see a pull request for my single line version renamed to FileOutputWriter
(which is a modification of RollingFileOutputWriter
) as a starting point for refactoring?
I would see this in line of flags:
Thanks
I would like to avoid adding a new file writer unless we can deprecate the old ones - otherwise we will have three to support, with a lot of duplication, and once we have added FileOutputWriter
we can't really change how it is configured without breaking backwards compability.
If you want changes merged, I suggest that you for now add a configuration flag to the RollingFileOutputWriter
to support single line logging. That does not feel too invasive.
If you want to work more on it and create a more generic FileOutputWriter
to support all cases as I outlined above it would be appreciated!
I'm considering writing a single line per collection rolling file write in the format:
key1=value1, key2=value2, key3=value3 . . .
This allows for improved parsing by Splunk (http://dev.splunk.com/view/logging-best-practices/SP-CAAADP6) and possibly by other (file based) log collectors.
Would you like this writer contributed? If so, do you have a preferred Java class name?
or would you possibly like to change the formatting to single line per collection for:
org\jmxtrans\agent\FileOverwriterOutputWriter.java org\jmxtrans\agent\RollingFileOutputWriter.java
Please comment. Thanks