-Dlog4j.configurationFile not loaded correctly after moving from vertx 3.9.3 to vertx 4.1.0

984 views
Skip to first unread message

Mansi Agrawal

unread,
Jun 23, 2021, 2:09:57 AM6/23/21
to vert.x
Hi,
I have recently migrated my application from vertx 3.9.3 to. vertx 4.1.0.
My application has following program Argument -
-Dlog4j.configurationFile=log4j2_e0.xml
This file is loaded up correctly on running the service in local on vertx 3.9.3.

But after migration  to 4.1.0, log42j.xml default file is loaded up, irrespective of whatever we provide in the argument.

Can anyone help me in solving this issue?

Thomas SEGISMONT

unread,
Jun 23, 2021, 4:35:30 AM6/23/21
to vert.x
Reading https://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration

The sysprop should be "-Dlog4j2.configurationFile", not "log4j.configurationFile". Perhaps that's the issue?

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/0156b8ba-d49b-4612-a9a8-41ace83c6782n%40googlegroups.com.

V V

unread,
Jun 23, 2021, 5:33:47 AM6/23/21
to ve...@googlegroups.com
Hello!
@Thomas, I believe both options should work fine although "log4j.configurationFile" is legacy: https://logging.apache.org/log4j/2.x/manual/configuration.html, "Log4j 2 global configuration properties".
@Mansi, how do you know which logger is used? Best way to gather more food for thought is to add "-Dlog4j2.debug" option to enable log4j2 initialization logging and inspect delegateFactory variable value at the end of https://github.com/eclipse-vertx/vert.x/blob/master/src/main/java/io/vertx/core/logging/LoggerFactory.java initialize method. Maybe JULLogDelegateFactory is used, or SLF4JLogDelegateFactory via logback. In that case you should e.g. tune vertx.logger-delegate-factory-class-name or reconfigure slf4j 

With best regards,
Vladimir

ср, 23 июн. 2021 г. в 11:35, Thomas SEGISMONT <tsegi...@gmail.com>:

Mansi Agrawal

unread,
Jun 27, 2021, 4:36:25 AM6/27/21
to ve...@googlegroups.com
Thanks Thomas and Vladimir for the help.
This problem was solved by passing 
-Dlog4j.configurationFile flag in VM Options rather than Program Arguments.

@Thomas I had tried -Dlog4j2.configurationFile as well but it didn't work. The above solution worked. 

Thomas SEGISMONT

unread,
Jun 28, 2021, 5:53:35 AM6/28/21
to vert.x
Thanks for letting us know

Reply all
Reply to author
Forward
0 new messages