【发布时间】:2018-10-09 04:02:25
【问题描述】:
我创建了具有以下值的 log4j.properties 文件,该文件使用套接字附加程序将日志路由到 Esaas。但是没有任何日志写入logstash。
log4j.appender.logstash=org.apache.log4j.net.SocketAppender
log4j.appender.logstash.RemoteHost=esaashost.somecompany.intranet
log4j.appender.logstash.port=65433
log4j.appender.logstash.ReconnectionDelay=60000
log4j.appender.logstash.LocationInfo=true
log4j.appender.socket.LocationInfo=true
log4j.appender.logstash.KeyStore.path=<<JKS location>>
log4j.appender.logstash.TrustStore.path=<<JKS location>>
log4j.appender.logstash.KeyStore.location=<<JKS location>>
log4j.appender.logstash.TrustStore.location=<<JKS location>>
log4j.appender.logstash.truststore.password=password
由于我们的 Esaas 服务器托管在 Intranet 中,我正在设置远程主机、端口、信任/密钥库文件详细信息等。如果我遗漏了什么,请告诉我。
然后我用下面的代码写日志
Logger logger = LoggerFactory.getLogger(ClassName.class);
logger.Info("Info Log");
上面的代码正确吗?或者,我是否遗漏了什么/写错了什么?
【问题讨论】:
标签: java log4j elastic-stack