Heimdall is a monitoring and alerting aspect oriented programming library for Spring Boot applications. It allows you to log method calls, capture method arguments and return values, and send email alerts for errors. With Heimdall, you can monitor your application's behavior and receive notifications about critical issues in real-time.
- Method Call Logging: Monitor method calls in your Spring Boot application and log detailed information about each invocation.
- Error Alerting: Receive email alerts for exceptions and errors occurring in your application, enabling proactive issue detection and resolution.
- Customizable Configuration: Easily configure email settings, logging preferences, and other aspects of Heimdall to suit your application's requirements.
- Asynchronous Logging: Utilize a shared log queue manager for asynchronous logging, ensuring minimal impact on application performance. Setup
Add Heimdall as a dependency in your pom.xml or build.gradle file. Build the code from this repo in your workspace and add the dependency as below:
<dependency>
<groupId>com.deepaknn.aop</groupId>
<artifactId>heimdall</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
Configure the email settings and logging preferences in your application properties file as below:
#configure your host, for e.g. smtp.elasticemail.com
email.host=<your host>
#configure port, for e.g. 2525
email.port=<your port>
email.username=<your username here>
email.password=<your password here>
email.from = system@example.com
email.to=support1@example.com,support2@example.com
email.subject=Error Alert
#configure your queue size, old logs from the queue will get polled if it reaches the size. Default is 1000
log.queue.size=100
#configure as true if method logs needs to be printed to standard output. Default is false
log.print=true
Annotate classes with @EnableHeimdall to enable monitoring and alerting as below:
@RestController
@EnableHeimdall
public class ExampleController {
@GetMapping("/example")
public String exampleMethod() {
// Your method logic here
return "Example Response";
}
}
In this example, the exampleMethod is monitored by Heimdall, method will be looged and an email alert will be sent if any exceptions occur during its execution.
Build and run your Spring Boot application.
Once Heimdall is integrated into your project, it automatically monitors method calls and sends email alerts for errors. You can customize its behavior by adjusting the configuration settings and annotating specific classes or methods.
Contributions to Heimdall are welcome! If you encounter any issues or have ideas for improvements, please submit a pull request or open an issue on our GitHub repository.
For questions, feedback, or support, please contact deepaknnofficial@gmail.com or visit our GitHub repository https://github.com/deepaknn/heimdall for additional resources.
