LogAuditor application to audit log i.e. it will Scan each line from the log file and checks if it's a starter or finisher log. It identifies the alert criteria & inserts into database and show the output on the console.
Eclipse - Enterprise Java Developers Oxygen Release (4.12.0)
Java - 1.8
Gradle - 5.6.2
-
I Assumed that only one log file is copied into the folder everytime. The application just picks a file from the path and doesnt delete the file.
-
If the file has a mismatch of start and finish logs count which means their counter parts are missing and may be available in the next file. Hence the log that is orphan(like start missing its finish vice versa), is still retained in a Map in the program.
-
Although there was a problem creating a file of larger memory, this program has been tested for the file of size 200Mb.
-
There can still be lot of junit test cases written. In the interest of time, I wrote only few.
Information before running the project
- Goto command prompt enter c:\users>Path to service project>\LogAuditor
- press enter.
- gradle clean
- press enter. It Will clean the project.
- gradle customFatJar
- press enter. It Will generate the custom Jar file which will have all dependencies which have been added in build.gradle.
There are couple of ways you can run this project.
========================== Run from executable jar ================================
- Ensure that you have a .jar file in the folder LogAuditor\build\libs\LogAuditor-all.jar
- Goto command prompt enter c:\users>Path to service project\LogAuditor> java -jar .\build\libs\LogAuditor-all.jar
- press enter
- The console will ask for Enter the File location and press ENTER button :
- press enter.
- If the File format is provided as per requirement, it will Scan each line from the log file and checks if it's a starter or finisher log .
- It identifies the alert criteria & inserts into database and show the output on the console.
==========================================================================
========================== Run from command line ================================
- Goto command prompt enter c:\users>Path to service project\LogAuditor> gradle run
- press enter
- gradle run
- The command line will ask for Enter the File location and press ENTER button :
- press enter.
- If the File format is provided as per requirement, it will Scan each line from the log file and checks if it's a starter or finisher log .
- It identifies the alert criteria & inserts into database and show the output on the console.
==========================================================================
========================== Run as main class from Eclipse ========================
- Open LogAuditor project in eclipse and refresh it using F5.
- Right click on Java file com.admin.process.logs.Application.java -> Run as -> Java Application.
- The console will ask for Enter the File location and press ENTER button :
- press enter.
- If the File format is provided as per requirement, it will Scan each line from the log file and checks if it's a starter or finisher log .
- It identifies the alert criteria & inserts into database and show the output on the console.
===========================================================================
========================== Running Junit Test cases ================================
- In the eclipse, go to the java class LogAuditorTestAll.java
- right click and Run as -> JUnit Test
- Junit tests will also be run automatically when you try to generate an executable from the eclipse.
===========================================================================