Top Description Methods
org.graalvm.nativeimage

public Interface LogHandler

Imports
org.graalvm.nativeimage.c.type.CCharPointer, org.graalvm.word.UnsignedWord

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 TypeMethod and Description
public void
fatalError()

Exit the VM because a fatal, non-recoverable error situation has been detected.

public void
flush()

Flush the log to its destination.

public void
log(CCharPointer bytes, UnsignedWord length)

Write raw bytes to the log.

Method Detail

fatalErrorback to summary
public 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
flushback to summary
public 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
logback to summary
public 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