Kafka源码工程examples项目配置log4j
2024-09-08 13:57:49
examples项目启动想知道有哪些错误,通过日志了解代码执行逻辑,但是启动SimpleConsumerDemo了报错如下:
log4j.proproties也配置了
log4j.proproties配置如下:
# 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=DEBUG, stdout, log log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n log4j.logger.kafka=DEBUG
log4j.logger.org.apache.kafka=DEBUG ### log file ###
log4j.appender.log = org.apache.log4j.DailyRollingFileAppender
log4j.appender.log.File = /Users/lizhitao/code/kafka-0.11.0.2-src/examples/logs/kafka.log
log4j.appender.log.Append = true
log4j.appender.log.Threshold = DEBUG
log4j.appender.log.DatePattern='.'yyyy-MM-dd
log4j.appender.log.layout = org.apache.log4j.PatternLayout
log4j.appender.log.layout.ConversionPattern = [kafka][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n # zkclient can be verbose, during debugging it is common to adjust is separately
log4j.logger.org.I0Itec.zkclient.ZkClient=WARN
log4j.logger.org.apache.zookeeper=WARN
No appenders could be found for logger,意思是log4.proproties找不到,如果默认位置找不到,我们可以自行动态配置
generateData()方法加入如下log4j配置代码:
PropertyConfigurator.configure("/Users/lizhitao/code/xxx-proj/kafka-0.11.0.2-src/examples/src/main/resources/log4j.properties");
再次启动SimpleConsumerDemo,搞定,日志有输出
最新文章
- collection中的retainAll()方法
- 体验CoreCLR的stack unwinding特性在Linux/Mac上的初步实现
- 【cs229-Lecture16】马尔可夫决策过程
- SGU 170	Particles(规律题)
- 作业5-需求分析(EX:南通大学成绩录入系统)
- jquery 下了框
- 【转】ODBC、OLE DB、 ADO的区别
- [windows phone开发]新生助手的开发过程与体会二
- VIM 同义词
- Java生成PDF报表
- jQuery.on() 函数详解[http://www.365mini.com/page/jquery-on.htm]
- c++数组指针bug
- 学习Java之前操作环境的安装及配置
- leetcode — reverse-linked-list
- CMDB服务器管理系统【s5day87】:需求讨论-设计思路
- python异常捕捉以及处理
- 配置linux-Fedora系统下iptables防火墙
- json Map JsonObject JsonArray
- AutoMapper在MVC中的运用06-一次性定义映射、复杂类型属性映射
- oracle SGA
热门文章
- TVP访谈 | 贝壳金服史海峰:中台虽百家争鸣,但不是所有企业必需品
- 【题解】ARC101F Robots and Exits(DP转格路+树状数组优化DP)
- 机器学习之路--Matplotlib
- 洛谷P1776 宝物筛选 题解 多重背包
- 2020 年 Java 程序员应该学习什么?
- Vector人工智能机器人SDK使用笔记
- 小白学 Python 爬虫(39): JavaScript 渲染服务 scrapy-splash 入门
- LeetCode刷题预备知识(二)
- 问题记录---关于posiition脱离文档流及vue中this.$route信息
- 如何利用Serilog的RequestLogging来精简ASP.NET Core的日志输出