I am using vertx 3.0 with spring boot. Now I am trying to config logger log levels, using below config:
JVM Arguments:
-Dspring.profiles.active=dev
-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory
-Djava.util.logging.config.file=logging.properties
logging.properties:
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ERROR
com.sensegrow.level=ERROR
JAVA Class:
package com.sensegrow.main;
@SpringBootApplication
public class Application{
private static Logger logger ;
public static JsonObject config;
private static Vertx vertx;
// Convenience method so you can run it in your IDE
public static void main(String[] args) throws Exception
{
logger = LoggerFactory.getLogger(Application.class);
logger.trace("trace");
logger.debug("debug");
logger.info("info");
logger.warn("warning");
logger.error("error");
SpringApplication.run(Application.class, args);
}
}
Output:
16:29:58.073 [ main] INFO - com.sensegrow.main.Application - info
16:29:58.076 [ main] WARN - com.sensegrow.main.Application - warning
16:29:58.076 [ main] ERROR - com.sensegrow.main.Application - error
As log level for package com.sensegrow is error. Why I am getting Info and warn level logs.
Vert. x uses low level IO library Netty. The application framework includes these features: Polyglot.
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. @FunctionalInterface public interface Handler<E> A generic event handler. This interface is used heavily throughout Vert. x as a handler for all types of asynchronous occurrences.
The whole purpose of the event loop is to react to events which are delivered to the event loop by the operating system. Event loop processes those events by executing handlers. To explain how the event loop operates, let's imagine a typical HTTP server application serving multiple client connections at the same time.
I configured Logback in Vert.x successfully, you can check the details in the following answer:
https://stackoverflow.com/a/43101501/973418
So, try this: give ur config file this name:
vertx-default-jul-logging.properties
and
place it into src/main/resources.
put in that content:
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=FINEST
.level=ERROR
com.sensegrow.level=ERROR
Run main(). This will work. From that on try to rename it and extend it to your needs. :)
Hope this helps.
PS: till here you dont need any jvm variables. Try this first and then extend it. If then something doens't work and you know exactly which argument, or so write again. :)
Jeerze,
Simon
For more information about logginfile name and logging in vertx3 see: Vertx3 Logging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With