Click here to Skip to main content
14,934,114 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to display all the logs in the computer for the given period of time
in apache tomcat webpage
display the logs from start time to end time which should be got from the user

What I have tried:

I did know what to do
please help me
I am just starting with tomcat and log files
Updated 19-Jul-18 2:17am

1 solution

You did not specified what kind of tool or programming language you want to use.


There are multiple tools to view log files. Just search the web for something like "log file viewer" or "log file analyzer".

Programming language

Process the log file line by line. This can be done while reading line wise or by reading the whole content into an allocated buffer and operating on that. Both are common operations where many examples can be found in the web.

Write a function to get the timestamp from a line of the log file. How to do this depends on the format of the log file. If the log file contains ISO 8601 - Wikipedia[^] datetimes, you can get it as string (ISO 8601 datetimes can be compared as strings to check for being before or after a specific datetime). Otherwise you have to convert them to a binary datetime format.

Then skip all lines that are before the start date. Display the lines until the end date is reached.
Soma Sundar 20-Jul-18 4:55am
thanks for your information.

can i get any reference pages about that.

and i want to store the logs in database and database should update every 10 mins

and get the logs created that time

and diaplay the specfic time logs which should be retirved from the database(which cannot be a problem we can retrieve using any querys)

i want to store the logs in the database and database should update every 10 mins

can i get any reference for that.thanks in advance
Jochen Arndt 20-Jul-18 5:27am
Reference about what?

Requesting a reference requires naming the topic / method / specification.
Then it is easy to get the information with a web research.

See Logging in Tomcat which explains how you can setup logging with Tomcat. If you want to use a database, select a logging toolkit that provides such functionality, install it, and configure Tomcat to use it. Then the log database is updated with each new log event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900