首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >log4j在Apache中失败

log4j在Apache中失败
EN

Stack Overflow用户
提问于 2022-01-10 12:37:57
回答 1查看 335关注 0票数 0

我是Apache的新手,我正在使用来设置一个Kafka3.0.0动物园管理员-无卡夫卡集群。当我尝试生成一个随机存储UUID时,我得到:

代码语言:javascript
运行
复制
//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,但似乎没有日志记录。这是卡夫卡虫吗?还是我错过了什么?

文件工具-log4j.properties位于正确的位置并具有正确的权限。文件内容:

代码语言:javascript
运行
复制
> 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

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2022-01-13 17:46:41

是双反斜杠。如果我这样做了:

代码语言:javascript
运行
复制
/opt/kafka_2.13-3.0.0> ./bin/kafka-storage.sh random-uuid

而不是

代码语言:javascript
运行
复制
//opt/kafka_2.13-3.0.0> ./bin/kafka-storage.sh random-uuid

它可以工作,请参见。去想想..。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70652547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档