Class LogbackPrecompiler.Request.Builder
- Enclosing class:
LogbackPrecompiler.Request
LogbackPrecompiler.Request. applicationOutput(List), runtimeClasspath(List) and
targetRelease(int) are required.- Since:
- 3.2.0
-
Method Summary
Modifier and TypeMethodDescriptionapplicationOutput(List<Path> roots) The application's own output, in class path order: its resource roots and class directories, or a jar.build()Builds the request.closedClassPath(boolean closed) Whether the class path given here is exactly the one the application runs on, as it is for a packager that fixes the class path at packaging time.runtimeClasspath(List<Path> entries) The runtime class path after the application, in order: jars or directories.targetRelease(int release) The lowest Java release the application runs on.
-
Method Details
-
applicationOutput
The application's own output, in class path order: its resource roots and class directories, or a jar. Required.Pass the class directories as well as the resources. Two rules need them: the engine stands down when the application carries a Logback or SLF4J class of its own, and when a
Configuratoris already registered, which an annotation processor does by writing the service file to the class output. The roots are one layer of the class path: when two of them hold the same name, the first wins. There are two exceptions, because wherever the roots are class path entries of their own both files are found: when two roots hold alogback.xmlthe engine stands down, as Logback reports the file that occurs twice, and the packagedapplication*andbootstrap*files of every root are read, since Micronaut can merge them. Only the entriesLogbackPrecompiler.applicationInputs()describes are read; of everything else, the name. Every root has to exist.- Parameters:
roots- directories or jars- Returns:
- this builder
-
runtimeClasspath
The runtime class path after the application, in order: jars or directories. Required.Each entry is one layer: a jar gives the names of its central directory, a directory the names of its files. logback-classic, logback-core and slf4j-api are taken from here, never from the caller's own class path, and the
META-INF/MANIFEST.MFof the two Logback entries is read for their version. The packagedapplication*andbootstrap*configuration files of every entry are read as well, at its root, where Micronaut reads those of a dependency too, and underconfig/, which Micronaut reads only whenoverrideConfigLocationsadds it. The engine stands down when one might setlogger.configorlogback.configurationFile, or might import configuration withmicronaut.config.import, and warns when one might enable the distributed configuration client. Every entry has to exist.- Parameters:
entries- jars or directories- Returns:
- this builder
-
targetRelease
The lowest Java release the application runs on. Required.The generated classes are class files of Java 25, so the engine stands down below that: a service file that names a class the JVM cannot load breaks Logback's initialisation.
- Parameters:
release- a Java feature release, such as25- Returns:
- this builder
-
closedClassPath
Whether the class path given here is exactly the one the application runs on, as it is for a packager that fixes the class path at packaging time.falseby default.When it is not, the class path can change after the build: a later test run sees the same output directory, an IDE leaves stale output, a file is mounted into a container image. The generated configurator then checks on every call, at startup and on each logging refresh, where Logback itself would look, that no
logback-test.xmlis visible and that the first visiblelogback.xmlis the file that was compiled, by size and CRC-32, and hands over to Joran otherwise. A closed class path needs neither check: what was surveyed at build time is what runs.- Parameters:
closed-trueonly when nothing can be added to or changed on the class path- Returns:
- this builder
-
build
Builds the request.- Returns:
- the request
- Throws:
IllegalStateException- if a required input is not set
-