A Java command-line tool that analyzes log files and exports structured JSON summaries.
- Smart Log Parsing - Automatically detects ERROR, WARNING, and INFO levels
- Frequency Analysis - Tracks most common errors
- JSON Export - Structured output for integration with monitoring tools
- JUnit Tests - 12 unit tests validating core functionality
- Java 11+
- Maven 3.6+
mvn clean package
java -jar target/log-analyzer-1.0-SNAPSHOT.jarInput: application.log
2025-01-18 ERROR Database connection failed
2025-01-18 INFO Application started
2025-01-18 WARNING Low memory detected
2025-01-18 ERROR Database connection failed
Output: log-summary_2025-01-18_10-30-00.json
{
"timestamp": "2025-01-18",
"fileAnalyzed": "application.log",
"totalErrors": 2,
"totalWarnings": 1,
"totalInfo": 1,
"mostFrequentErrors": [
{
"message": "ERROR Database connection failed",
"count": 2
}
]
}- Java 14
- Maven
- Jackson (JSON processing)
- JUnit 4
src/
├── main/java/loganalyzer/
│ ├── LogAnalyzer.java # Core analysis logic
│ ├── JsonExporter.java # JSON export
│ └── ProgramRunner.java # Main application
└── test/java/loganalyzer/
└── *Test.java # Unit tests
- Automated error monitoring
- Integration with dashboards (Grafana, ELK)
- Historical error tracking