You can use Java util. Is logging configured to use compressed log files?
•
Java
Can I configure Java util. Logging to compress the log file when it "scrolls" to a new log file? For example, an excerpt from my log configuration file is as follows:
java.util.logging.FileHandler.level = ALL java.util.logging.FileHandler.pattern = /blah.log java.util.logging.FileHandler.limit = 10000000 java.util.logging.FileHandler.count = 5
Ideally, I want to write the current log message to blah log. 0 while retaining blah log. 1.gz,blah. log. 2. GZ et al
Please also note that I do not want to use other logging frameworks
Solution
Yes, but you must write your own file handler Just copy the source code of filehandler into the project (you can't extend this class in any useful way) and modify the open () method of meteredstream
After that, just use the normal configuration to use the new handler
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码