本文介绍了Linux上的vertx集群模式hazelcast日志配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using Eclipse on Windows, a vertx Verticle with a misconfigured cluster.xml shows the following error in the Eclipse console:

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上部署相同的代码和配置,并将其作为胖子运行时,则同一日志不会显示hz线程或vertx工作线程日志.取而代之的是,将垂直记录显示为:

This is fine, I know to reconfigure the cluster for multicast. The problem is when I deploy the same code and configuration to Linux, and run it as a fat jar then the same log doesn't show either the hz thread or the vertx worker thread logs. Instead it shows the verticle logs as:

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属性如下:

So if I run on Linux the log to tell me there's a misconfiguration isn't showing. There's something I am missing in the vertx / maven log config but I don't know what. Maven properties are as follows:

<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>

然后我使用以下命令启动胖子罐:

and I start the fat jar using:

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

如何获取hz线程和vertx线程来登录Linux?

How can I get the hz thread and vertx thread to log on Linux?

我尝试将下面的vertx-default-jul-logging.properties文件添加到Maven资源目录中,但是没有运气.

I've tried adding a vertx-default-jul-logging.properties file below to the maven resources dir but no luck.

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

感谢您的评论.

推荐答案

Vertx已开始添加日志记录

Vertx has started logging having added

-Djava.util.logging.config.file=../logging.properties

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

to the java start command and with the default logging.properties like (and this is a nice config for lower level stuff):

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

and vertx is logging to ../logs/vertx.log on Linux

这篇关于Linux上的vertx集群模式hazelcast日志配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:36