linyimin0812 / spring-startup-analyzer

spring-startup-analyzer generates an interactive spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it.🚀
Apache License 2.0
1.52k stars 121 forks source link

feat: Update logger initialization and customize log path #156

Closed 1chz closed 4 months ago

1chz commented 4 months ago

This change extends the logger initialization functionality and allows the log path to be customized via a system property. It has also expanded test coverage by adding tests for the new logger initialization scenarios and the custom log path. The README is also updated to document the new configuration option for defining the path for the logs.

linyimin0812 commented 4 months ago

When you specify the paths for startup and transform, the application will not start. Because the loadProperties method in the ProfilerSettings class depends on Logger, and since loadProperties is executed within a static block before LogFactory is fully initialized, the logger field in ProfilerSettings is null. This causes a NullPointerException (NPE) when loadProperties is called, leading to the initialization failure of ProfilerSettings. To resolve this, you might consider replacing the logger calls in loadProperties with System.out.println.

linyimin0812 commented 4 months ago

You can pull the latest code from the main branch, then run either the make all command or the mvn clean install package command to locally compile and package it for testing.

1chz commented 4 months ago

First of all, do you think this Pull Request idea is a good one? If you agree, I will try to proceed further.

linyimin0812 commented 4 months ago

First of all, do you think this Pull Request idea is a good one? If you agree, I will try to proceed further.

yes, it's a good idea