I am using a custom logger with useLogger() in my init.gradle script. The logger extends the BuildAdapter and implements the TaskExectutionListener. I am overriding the buildStarted method, but it is never actually called. Is this the correct method to override to get the notification when the build started?
The earliest possible time you can log something is right in ‘init.gradle’, by which time the build has already started. Since user code can only register a logger after the build has started, the ‘buildStarted’ method won’t be called anymore.
This question was asked before: When is Gradle.buildStarted called?
Yes, my main exercise to be able to calculate a build time using the logger class. Since when you take over the logger you lose the elapsed time of the build at the end. Is there any other simple way to calculate the build time since a user will never actually know when the build started? Or would it be enough to just calculate the time each task takes to complete and use that. Although task execution is not part of configuration.
You can approximate build start time with the time your init code runs.
ok, thanks. that works.