how to remove the logging data from JNativeHook library

Kingtak

i am trying to use jnativehook library in my project.i want to get a simple data (e.g Mouse Clicked: 2) instead of long loging data that jnativehook is Produced like:

May 31, 2015 9:39:04 PM org.jnativehook.GlobalScreen$NativeHookThread enable INFO: process_button_pressed [339]: Button 1 pressed 2 time(s). (293, 661)

May 31, 2015 9:39:04 PM org.jnativehook.GlobalScreen$NativeHookThread enable

Mouse Clicked: 2

INFO: process_button_released [361]: Button 1 released 2 time(s). (293, 661)

Yayotrón

If you want to remove that logging spam from JNativeHook:

// Clear previous logging configurations.
LogManager.getLogManager().reset();

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

Adding this to, for example. Your main class construct with remove (almost) all logging. Now let's detect yourself the events and print some basic information.

First, you have to register the NativeHook:

 GlobalScreen.registerNativeHook();

Then bind some listener to it, for example:

 GlobalScreen.getInstance().addNativeKeyListener(new YourMainClass());

And then override the JNativeHook event methods like this:

@Override
    public void nativeKeyPressed(NativeKeyEvent e) {
System.out.Println(((char) e.getKeyCode()) + " was pressed.")
}

Check out: JNativeHook GitHub, you will find some sample code (for example Global Mouse Listener and documentation about it's events.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Enterprise Library Logging - Remove hyphen from format

From Dev

How to remove large data from MySQL?

From Dev

How to remove data from database?

From Dev

How can I completely remove any logging from requests module in Python

From Dev

How to remove unsafe characters from string for logging in C#

From Dev

How to remove an item from a list by index using the lens library?

From Dev

Python logging from library module

From Dev

how remove zoom feature from android mpchart library?

From Dev

How to connect JNativeHook to JavaFX Thread?

From Dev

How to remove geometric data from PostGIS tables

From Dev

How can I remove extra data from Python logging file?

From Dev

How to refer to a standard library in a logging configuration file?

From Dev

How to remove unnecessary logging in Yii2?

From Dev

How to set the logging level for the elasticsearch library differently to my own logging?

From Dev

How to set the logging level for the elasticsearch library differently to my own logging?

From Dev

How to periodically remove data from Apache Solr?

From Dev

How to remove large data from MySQL?

From Dev

How can I completely remove any logging from requests module in Python

From Dev

How to remove unsafe characters from string for logging in C#

From Dev

How to remove data from table if the ID is in the column

From Dev

How to remove repeated data from a list in angularjs?

From Dev

Logging: How to filter INFO messages from request library?

From Dev

How to iteratively search and remove from a list when not using the standard library

From Dev

How to remove geometric data from PostGIS tables

From Dev

How to refer to a standard library in a logging configuration file?

From Dev

How do I aggregate data from the morgan logging library?

From Dev

Remove only a library from cocoapod project, how i can do?

From Dev

How to remove particular data from table view

From Dev

How to remove pieces of data from string

Related Related

  1. 1

    Enterprise Library Logging - Remove hyphen from format

  2. 2

    How to remove large data from MySQL?

  3. 3

    How to remove data from database?

  4. 4

    How can I completely remove any logging from requests module in Python

  5. 5

    How to remove unsafe characters from string for logging in C#

  6. 6

    How to remove an item from a list by index using the lens library?

  7. 7

    Python logging from library module

  8. 8

    how remove zoom feature from android mpchart library?

  9. 9

    How to connect JNativeHook to JavaFX Thread?

  10. 10

    How to remove geometric data from PostGIS tables

  11. 11

    How can I remove extra data from Python logging file?

  12. 12

    How to refer to a standard library in a logging configuration file?

  13. 13

    How to remove unnecessary logging in Yii2?

  14. 14

    How to set the logging level for the elasticsearch library differently to my own logging?

  15. 15

    How to set the logging level for the elasticsearch library differently to my own logging?

  16. 16

    How to periodically remove data from Apache Solr?

  17. 17

    How to remove large data from MySQL?

  18. 18

    How can I completely remove any logging from requests module in Python

  19. 19

    How to remove unsafe characters from string for logging in C#

  20. 20

    How to remove data from table if the ID is in the column

  21. 21

    How to remove repeated data from a list in angularjs?

  22. 22

    Logging: How to filter INFO messages from request library?

  23. 23

    How to iteratively search and remove from a list when not using the standard library

  24. 24

    How to remove geometric data from PostGIS tables

  25. 25

    How to refer to a standard library in a logging configuration file?

  26. 26

    How do I aggregate data from the morgan logging library?

  27. 27

    Remove only a library from cocoapod project, how i can do?

  28. 28

    How to remove particular data from table view

  29. 29

    How to remove pieces of data from string

HotTag

Archive