Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

How to quickly find if a word exists or not in a text file?

Thread view: 
www - 26 Jan 2007 16:34 GMT
Hi,

My Java needs to check a log file to see if things are correct. If there
is a word, "successfully", then it is correct. I hate to read in each
line, parse it into tokens, and check each token. Is there a better way
to do it?

Thank you.
Danno - 26 Jan 2007 16:49 GMT
> Hi,
>
[quoted text clipped - 4 lines]
>
> Thank you.

If you use log4j you can create your own intercepting appender that
alerts you when the "successfully" message is placed into the log file.
Alex Hunsley - 27 Jan 2007 02:49 GMT
> Hi,
>
> My Java needs to check a log file to see if things are correct. If there
> is a word, "successfully", then it is correct. I hate to read in each
> line, parse it into tokens, and check each token. Is there a better way
> to do it?

Break into tokens? How about using String.indexOf() instead?

> Thank you.
Daniel Pitts - 27 Jan 2007 05:33 GMT
> Hi,
>
[quoted text clipped - 4 lines]
>
> Thank you.
How about using indexOf or regex? Better yet, is there any way the
log-writting process can indicate success/failure through another more
direct means? Such as return code?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.