使用tail -F收集日志时,经常报出file truncated, 导致日志又重新读取.
tail: `test.out' has appeared; following end of new file
1
2
3
4
tail: test.out: file truncated
以前没注意,后来查询资料,说是某些程序应用不是采用Appender的方式追加内容,而是使用Replacer的方式追加内容.导致文件被重新覆盖.这样就让tail无所适从,采用全部输出的策略.
要应用这种处理很麻烦.暂且不处理!