linux

时间:2015-11-05 12:26:57

标签: log4j2 hazelcast vert.x

在Windows上使用Eclipse,带有错误配置的cluster.xml的vertx Verticle在Eclipse控制台中显示以下错误:

11:46:18.536 [hz._hzInstance_1_dev.generic-operation.thread-0] ERROR com.hazelcast.cluster - [192.168.25.8]:5701 [dev] [3.5.2] Node could not join cluster. A Configuration mismatch was detected: Incompatible joiners! expected: multicast, found: tcp-ip Node is going to shutdown now!
11:46:22.529 [vert.x-worker-thread-0] ERROR com.hazelcast.cluster.impl.TcpIpJoiner - [192.168.25.8]:5701 [dev] [3.5.2] com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not active!

这很好,我知道要重新配置群集以进行多播。问题是当我将相同的代码和配置部署到Linux并将其作为胖jar运行时,相同的日志不会显示hz线程或vertx工作线程日志。相反,它将垂直日志显示为:

2015-11-05 12:03:09,329 Starting clustered Vertx
2015-11-05 12:03:13,549 ERROR: VerticleService failed to start: java.lang.NullPointerException

因此,如果我在Linux上运行日志告诉我,配置错误是不会显示的。我在vertx / maven日志配置中缺少了一些东西,但我不知道是什么。 Maven属性如下:

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <exec.mainClass>main.java.eiger.isct.service.Verticle</exec.mainClass>
  <log4j.configurationFile>log4j2.xml</log4j.configurationFile>
  <hazelcast.logging.type>log4j2</hazelcast.logging.type>
</properties>

我用:

启动胖罐

java -Dlog4j.configuration=log4j2.xml -jar Verticle-0.5-SNAPSHOT-fat.jar

如何让hz线程和vertx线程登录Linux?

我已经尝试将以下vertx-default-jul-logging.properties文件添加到maven资源目录但没有运气。

com.hazelcast.level=ALL
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.FileHandler.level=ALL

感谢您的评论。

1 个答案:

答案 0 :(得分:0)

Vertx已开始添加

的日志记录
-Djava.util.logging.config.file=../logging.properties

java启动命令和默认的logging.properties之类的(对于较低级别的东西,这是一个不错的配置):

handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS:%1$tL %4$s %2$s %5$s%6$s%n
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.pattern=../logs/vertx.log

.level=ALL
io.vertx.level=ALL
com.hazelcast.level=ALL
io.netty.util.internal.PlatformDependent.level=ALL

并且vertx在Linux上登录到./logs/vertx.log