Results 1 to 2 of 2
  1. #1
    motress is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default Does anyone know how to read a log file in .log and output the data using java langua

    Does anyone know how to read a log file in .log and output the data using java language ?
    Pls help me....

  2. #2
    Turtle is offline Member
    Join Date
    Nov 2007
    Location
    New Zealand
    Posts
    36
    Rep Power
    0

    Default

    Lesson: Basic I/O (The Java™ Tutorials > Essential Classes)

    Java Code:
    import java.io.*;
    class LogReader {
      public static void main(String[] args) throws Exception {
        File logFile = new File("log.txt");
        BufferedReader br = new BufferedReader(new FileReader(logFile));
        String line;
        while ( (line = br.readLine()) != null) {
         System.out.println(line);
        }
      }
    }

Similar Threads

  1. Need a solution to read and store data from a file
    By sheetalnri in forum New To Java
    Replies: 10
    Last Post: 09-30-2010, 06:43 AM
  2. taking data from recent output file
    By sara12345 in forum New To Java
    Replies: 3
    Last Post: 01-05-2010, 11:48 PM
  3. Replies: 40
    Last Post: 07-04-2008, 08:41 AM
  4. Replies: 0
    Last Post: 04-17-2008, 07:36 PM
  5. How to read a text file from a Java Archive File
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-08-2008, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •