Class LogbackPrecompiler.Result

java.lang.Object
io.micronaut.aot.logback.LogbackPrecompiler.Result
Enclosing class:
LogbackPrecompiler

@Internal public static final class LogbackPrecompiler.Result extends Object
The outcome of one precompilation: its status(), one message() for the caller to log, the generated entries(), and the warnings() the caller logs at warning level, which most results do not have.
Since:
3.2.0
  • Method Details

    • status

      public LogbackPrecompiler.Status status()
      What happened.
      Returns:
      the status
    • message

      public String message()
      One line for the caller to log: what was compiled, or why nothing was. It is informational for LogbackPrecompiler.Status.GENERATED and LogbackPrecompiler.Status.STOOD_DOWN and worth a warning for LogbackPrecompiler.Status.FAILED. Whatever else deserves a warning is in warnings(), never in this line.
      Returns:
      the line
    • warnings

      public List<String> warnings()
      Lines for the caller to log at warning level, each on its own, after message(). Each line is complete: it names the file it is about, what it means at run time and what to do instead.

      Only a LogbackPrecompiler.Status.GENERATED result can have any, and most have none. It has one line for each packaged application* or bootstrap* file, of the application output or of an entry of the runtime class path, that may enable Micronaut's distributed configuration client (micronaut.config-client.enabled set to true, or to any placeholder, which the run time may resolve to true): a logger.config or logback.configurationFile that distributed configuration supplies is not applied while the generated configurator is registered. A client that is enabled in another way cannot be seen and gives no line: by an environment variable, a system property or properties passed to ApplicationContext.builder(); by a file that is not on the class path of the request, or that the scan does not read, such as a bootstrap file of another name that the micronaut.bootstrap.name system property selects; or by a value that a packaged Groovy file computes, such as from System.getenv.

      Returns:
      the lines, unmodifiable, in class path order; empty unless status() is LogbackPrecompiler.Status.GENERATED
    • entries

      public Map<String,byte[]> entries()
      The generated entries: the class files and the META-INF/services/ch.qos.logback.classic.spi.Configurator file, by entry name, in order.

      The caller writes every entry, by its name, below one directory that is on the application's class path next to its logback.xml, or adds every entry to one archive. They have to stay together, on the same class loader: the generated configurator calls the classes copied next to it, which are package-private.

      Removing the output of an earlier build is the caller's job, because only the build tool knows whether a directory is its own. A caller that writes into one of the roots it passes as application output, such as a class directory, has to remove that earlier output before it calls LogbackPrecompiler.precompile(Request) again, not after: the engine neither replaces nor removes it, and the call is LogbackPrecompiler.Status.FAILED while it is there. The output is the service file and the classes of the package io.micronaut.aot.logback.generated.

      Returns:
      the entries, unmodifiable; empty unless status() is LogbackPrecompiler.Status.GENERATED