Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Advanced-java] simulate Unix tail -f function
- From: fgreco@xxxxxxxxxxxxxxxxxx (Frank D. Greco)
- Subject: [Advanced-java] simulate Unix tail -f function
- Date: Mon, 22 Apr 2002 11:43:51 -0400
At 09:52 AM 4/22/2002 -0400, Karen Shiau wrote: >I have an application which will read log files from other >apps, and grep "ERROR" or "WARNING" on those log files. >However, the new log text is keep coming and appending to the >end of files. How can I simulate the functionality of Unix >tail -f command on Java? No magic... just do what tail does. Periodically check the mod time of the file. When you have a "newer" file, print the last line (keep track of where you are in the file for the next new data). Personally, I'd create a class that fired my own events (e.g., "ModifiedFileEvent", "AppendedDataFileEvent") when certain file-oriented things happened. I'm an event-oriented kinda guy... :) Of course to simulate GREP (not that you asked or anything), take a look at the new regex stuff in 1.4. Frank G. +======================================================================+ | Crossroads Technologies Inc, 55 Broad Street, 28th Fl, NYC, NY 10004 | | Enterprise Java Engineering | | Email: fgreco@xxxxxxxxxxxxxxxxxx Web: www.CrossroadsTech.com | | Pager: 800-495-6244 ePager: 4956244@xxxxxxxxxx | | Voice: 212-482-5280 x229 Fax: 212-482-5281 | +======================================================================+
- Follow-Ups:
- [Advanced-java] simulate Unix tail -f function
- From: kevin graham
- [Advanced-java] simulate Unix tail -f function
- References:
- [Advanced-java] simulate Unix tail -f function
- From: Karen Shiau
- [Advanced-java] simulate Unix tail -f function
- Prev by Date: [Advanced-java] Debugger software
- Next by Date: [Advanced-java] simulate Unix tail -f function
- Previous by thread: [Advanced-java] simulate Unix tail -f function
- Next by thread: [Advanced-java] simulate Unix tail -f function
- Index(es):