Module 10: Strings, Files, and Everyday Core APIs
Mini-Project: Log File Analyzer
Parse a simple log file, count events, and produce a readable summary report.
Author
Java Learner Editorial Team
Reviewer
Technical review by Java Learner
Last reviewed
2026-04-17
Java version
Java 25 LTS
Learning goals
- Combine file reading, regex, and formatting in one project
- Practice extracting useful data from text
- Produce cleaner output instead of raw line dumps
Project goal: Read a log or sample text file, count matching events such as ERROR or WARN, and print a short summary.
What to practice: Path, Files, loops, regex or contains() checks, and formatted output.
Stretch ideas: Group counts by date, extract usernames, or write the summary back to a new file.
Success check: Someone should be able to read your output and understand the file state quickly.
Runnable examples
A simple count-based start
int errors = 0;
for (String line : lines) {
if (line.contains("ERROR")) {
errors++;
}
}
System.out.println("Errors: " + errors);Expected output
Errors: 2
Mini exercise
Start with counting one keyword such as `ERROR`, then expand to two categories like `INFO` and `ERROR`.
Summary
- This project turns several practical core APIs into one workflow.
- Readable summaries matter more than dumping raw data.
- Small automation tasks are a strong way to practice intermediate Java.
Next step
The next module focuses on collections, so you can organise data well before moving into generics and streams.
Sources used