Vert.x: the best way to enter a file

What is the fastest asynchronous way to write to a file in Vert.x?

The goal is to write logs from registrars from different classes (for example, Class1, Class2, etc.) into 1 file (something like "console.log")

+4
source share
2 answers

Vert.x uses the JDK-related JUL logging framework to avoid the delivery of additional dependencies. However, it allows you to add a custom registrar implementation.

, , , java.util.logging.config.file:

  • , () , :

    handlers = java.util.logging.MyFileHandler
    config   =
    #...
    
  • Vert.x:

    -Djava.util.logging.config.file=config/logging.properties
    
  • Logger :

    Logger logger = LoggerFactory.getLogger("some.package.MyClass");
    
  • , (-):

    logger.info("some informative message");
    

, ( FileHandler).

Vert.x , .

+3

, .. . , . slf4j + log4 .

+1

Source: https://habr.com/ru/post/1606389/


All Articles