[英]How to read from a dynamic file in Groovy
I've got the log file for a program; 我有一个程序的日志文件; the log records every task done by the software. 日志记录了软件完成的所有任务。 I've modified the software to insert a line such as "operations terminated"
into the log when the software is done executing. 我已修改软件,以在软件执行完毕后在日志中插入一行,例如"operations terminated"
。 I am trying to write a script in Groovy that looks for this "operations terminated"
line in the log file. 我试图用Groovy编写脚本,以在日志文件中查找此"operations terminated"
行。 I am unsure how to proceed because the log file changes with time and I want to catch "operations terminated"
as soon as it pops up. 我不确定如何继续,因为日志文件会随时间变化,因此我想在弹出时立即捕获"operations terminated"
。 I don't know how to put in a recursive or continuous check... Suggestions? 我不知道如何进行递归或连续检查...建议? Thanks! 谢谢!
monitoring may be a solution 监控可能是一个解决方案
https://stackoverflow.com/a/495962/722948 https://stackoverflow.com/a/495962/722948
So then. 那就这样 you could take the delta of the file and search for a specific line/word 您可以获取文件的增量并搜索特定的行/单词
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.