[英]log4j fails in Apache Kafka
我是 Apache Kafka 的新手,我正在使用它來設置 Kafka 3.0.0 ZooKeeper-less kafka 集群。 當我嘗試生成存儲隨機 UUID 時,我得到:
//opt/kafka_2.13-3.0.0> ./bin/kafka-storage.sh random-uuid
log4j:ERROR Could not read configuration file from URL [file://opt/kafka_2.13-3.0.0/bin/../config/tools-log4j.properties].
java.net.UnknownHostException: opt
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
at java.base/java.net.Socket.connect(Socket.java:633)
at java.base/sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:1045)
at java.base/sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:1010)
at java.base/sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1102)
at java.base/sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1088)
at java.base/sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:320)
at java.base/sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:426)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:557)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.slf4j.impl.Log4jLoggerFactory.<init>(Log4jLoggerFactory.java:66)
at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
at com.typesafe.scalalogging.Logger$.apply(Logger.scala:31)
at kafka.utils.Log4jControllerRegistration$.<clinit>(Logging.scala:25)
at kafka.tools.StorageTool$.<clinit>(StorageTool.scala:32)
at kafka.tools.StorageTool.main(StorageTool.scala)
log4j:ERROR Ignoring configuration file [file://opt/kafka_2.13-3.0.0/bin/../config/tools-log4j.properties].
log4j:WARN No appenders could be found for logger (kafka.utils.Log4jControllerRegistration$).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
znl51P7oQX2GDsfi2FRE7g
我得到了 UUID,但似乎沒有日志記錄。 這是卡夫卡的錯誤嗎? 還是我錯過了設置中的某些內容?
文件 tools-log4j.properties 位於正確的位置並具有正確的權限。 文件內容:
> cat /opt/kafka_2.13-3.0.0/config/tools-log4j.properties
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
log4j.rootLogger=WARN, stderr
log4j.appender.stderr=org.apache.log4j.ConsoleAppender
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
log4j.appender.stderr.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.stderr.Target=System.err
謝謝。
這是雙反斜杠......如果我這樣做:
/opt/kafka_2.13-3.0.0> ./bin/kafka-storage.sh random-uuid
代替
//opt/kafka_2.13-3.0.0> ./bin/kafka-storage.sh random-uuid
它有效,另見this 。 Go 圖...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.