Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9020325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:59:18+00:00 2026-06-16T04:59:18+00:00

Is it possible to read log files (abc.log) using java? I want a specific

  • 0

Is it possible to read log files (abc.log) using java?

I want a specific string from my log file.

suppose this is the content of my logfile. I want the time stamp only (eg: 05:08:37) and print it the console.

2012-12-16 05:08:37,905 [Thread-1] INFO  com.submit.SubmitService - Wait time 500

2012-12-16 05:08:38,444 [Thread-1] INFO  com.submit.SubmitService - NO OF  RECORDS TILL NOW 3755    TOTAL TIME -- << 539

2012-12-16 05:08:38,668 [Thread-1] INFO  com.submit.SubmitService - Active Connection:: -69076

2012-12-16 05:08:38,670 [Thread-1] INFO  com.submit.SubmitService - Active Connection:: -65764
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:59:19+00:00Added an answer on June 16, 2026 at 4:59 am

    You can read your “log-file” as a normal file.

    Then you can use, for instance, regular expression, to obtain the part of the string that you need:

    try{
       FileInputStream fstream = new FileInputStream("abc.log");
       BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
       String strLine;
       /* read log line by line */
       while ((strLine = br.readLine()) != null)   {
         /* parse strLine to obtain what you want */
         System.out.println (strLine);
       }
       fstream.close();
    } catch (Exception e) {
         System.err.println("Error: " + e.getMessage());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is possible to read from a txt file in loop like this? files names:
We want to be able to create log files from our Java application which
Is is possible ot configure Chainsaw to read log files that have been customized
Is it possible to read the content of a file that has been selected
I want to read a log file that is constantly being written to. It
Just wondering if it is possible to figure out who has read files from
I want to delete all lines from old log files and keep fresh 50
Possible Duplicate: Java Too Many Open Files This is not a duplicate, the referred
Ok, suppose I have Ruby program to read version control log files and do
I know that it is possible read and write data from mongodb via hadoop.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.