Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 1.23 KB

ConsoleOutput.md

File metadata and controls

34 lines (28 loc) · 1.23 KB

Logging and Console Output

As of version 2.0, JNativeHook includes an internal Logger to handle nearly all console output. By default, JNativeHook will use the default Logger configured by the JVM.

Set the log level to only display warnings and errors.

// Get the logger for "com.github.kwhat.jnativehook" and set the level to warning.
Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
logger.setLevel(Level.WARNING);

// Don't forget to disable the parent handlers.
logger.setUseParentHandlers(false);

Disable all console output.

// Get the logger for "com.github.kwhat.jnativehook" and set the level to off.
Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
logger.setLevel(Level.OFF);

// Don't forget to disable the parent handlers.
logger.setUseParentHandlers(false);

Set the log level to display everything.

// Get the "com.github.kwhat.jnativehook" logger and set the level
Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
logger.setLevel(Level.ALL);

// Don't forget to disable the parent handlers.
logger.setUseParentHandlers(false);