Interface LogHandler


public interface LogHandler
Low-level handler for log messages of native images. Implement this interface to create a custom log handler, i.e., redirect log messages. The custom log handler must be installed in the ImageSingletons, using this interface as the key, at Feature.duringSetup() time:
    class LogHandlerFeature implements Feature {
        @Override
        public void duringSetup(DuringSetupAccess access) {
            ImageSingletons.add(LogHandler.class, new CustomLogHandler());
        }
    }
 
If no custom log handler is installed, a default is installed Feature.beforeAnalysis() before the static analysis. The default handler prints log messages to the standard output. Installing a custom log handler at a later time, after the default one has been installed, results in an error.

The methods defined in this interface are called from places where Java object allocation is not possible, e.g., during a garbage collection or before the heap is set up. If an implementation of the interface allocates a Java object or array, an error is reported during image generation.

Since:
19.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Exit the VM because a fatal, non-recoverable error situation has been detected.
    void
    Flush the log to its destination.
    void
    log(CCharPointer bytes, UnsignedWord length)
    Write raw bytes to the log.
  • Method Details

    • log

      void log(CCharPointer bytes, UnsignedWord length)
      Write raw bytes to the log.

      The methods defined in this interface are called from places where Java object allocation is not possible, e.g., during a garbage collection or before the heap is set up. If an implementation of the interface allocates a Java object or array, an error is reported during image generation.

      Since:
      19.0
    • flush

      void flush()
      Flush the log to its destination.

      The methods defined in this interface are called from places where Java object allocation is not possible, e.g., during a garbage collection or before the heap is set up. If an implementation of the interface allocates a Java object or array, an error is reported during image generation.

      Since:
      19.0
    • fatalError

      void fatalError()
      Exit the VM because a fatal, non-recoverable error situation has been detected. The implementation of this method must not return, and it must not throw a Java exception. A valid implementation is, e.g., to ask the OS to kill the process.

      The methods defined in this interface are called from places where Java object allocation is not possible, e.g., during a garbage collection or before the heap is set up. If an implementation of the interface allocates a Java object or array, an error is reported during image generation.

      Since:
      19.0