java - FOSS LIB not HOW TODO: OutputStream that auto rolls when file gets too big or hour/day et change -
id outputstream performs many of functions found in rollingxxxappender classes in log4j.
are there foss libraries support sort of smarts simple outputstream. id rather code not aware of rolling process , not require hints when roll ? ideally rolling control helpers passed factory , hidden deep inside abstraction.
sample use case
- closing -> file.txt
- renaming original backup -> file.txt -> file.001
- recreating empty file , continue writing -> file.txt
this sort of functionality works best system requires creation of large files such logging.
potentional problems
- it should have smarts , not roll in middle of line write. best solution have roll tests performed before/after write rather in middle.
re: tips on how write own..
i dont want write own, know how - why mentioned rollingxxxappender. rather leverage effort of preexisting library.
i think can implement extending fileoutputstream. 1 thing bear in mind, though, approach makes sense if willing keep file open -instead of opening , closing in each write ; in turn makes sense if writing log file centralized.
Comments
Post a Comment