File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes Data Structure? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Data Structure?" Watch "Data Structure?" New topic
Author

Data Structure?

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
This was one of the interview question that I faced.

A log file contains the text in the following format
logTime appName loglevel logText
logTime appName loglevel logText
logTime appName loglevel logText
logTime appName loglevel logText
.
.
.
.
n

which is the best suited Data structure for this. Such that we can search logs. For instance log search with condition as logTime or condition as LogTime and appName?

SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
Two Master tables for App Name and Log level. Another table having log time, log text and FKs from master tables. Total 3 tables required.

Then you can query DB using various JOINs.

???!!!
Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
which Data Structure. No DB is to be used.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

Sorry, you asked what was the best. A database would be best.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data Structure?
 
Similar Threads
Using JDBCAppender for older versions of JDK
log level parameter?
Need help with log4j logging tool to log into database
LDAP with Grails
arraylist with O(log n) insertion/removal/search