java - Kafka Connect 没有记录我的连接器日志
问题描述
我写了一个自定义的 Kafka 源连接器。我想测试连接器,所以我将 uber JAR 复制到该${CONFLUENT_HOME}/share/java
位置,并将配置(connect-standalone.properties
和connect-file-source.properties
)放在我为连接器创建的目录下的 etc 位置中。
当我尝试按如下方式启动连接器时:
$CONFLUENT_HOME/bin/connect-standalone $CONFLUENT_HOME/etc/kafka/connect-standalone.properties $CONFLUENT_HOME/etc/kafka/connect-file-source.properties
我试图运行我的连接器。它启动并将记录生成到 Kafka。但是,我在任何地方都看不到我的连接器日志。我尝试添加连接器的 log4j.properties,还尝试更新 connect-log4j.properties。我仍然没有看到我的日志。
例如:我有这样的日志语句:
@Override
public void start(Map<String, String> props) {
log.info("*** Start Method called ***");
filename = props.get(FileStreamTailerSourceConnector.FILE_CONFIG);
下面是我的connect-file-source.properties
文件的片段。
name=kafka-connect-file
connector.class=com.connect.file.FileStreamTailerSourceConnector
tasks.max=1
#Path to where the file is going to be published.
file=test_data.csv
# Topic to publish file data to.
# MANDATORY FIELD, no default
# Valid Values: non-empty string and no ISO control characters
topic=tailer_test2
# Window of data to pull from log api.
# Valid Values: [2,...,10000]
# The default is 100.
batch.size=2
# Poll interval in milliseconds. E.G. Roughly, how often the connector will connect to the file and read data.
# The default is 1000 as in once a second.
poll.interval=1000
# Schema file for the records of the file
source.schema=test_data_schema.avsc
# Encryption of fields in the record for security
field.encryption=true
encryption.fields=bin,ssn,acn
encryption.class=com.connect.encryption.DummyEncryption
以下是我的片段connect-standalone.properties
:
# A list of host/port pairs to use for establishing the initial connection to the Kafka cluster.
bootstrap.servers=<LIST OF COMMA SEPARATED BOOTSTRAP SERVERS>
# unique name for the cluster, used in forming the Connect cluster group. Note that this must not conflict with consumer group IDs
group.id=connect-cluster-file-test1
offset.storage.topic=connect-offsets-test1
offset.storage.replication.factor=1
config.storage.topic=connect-configs-test1
config.storage.replication.factor=1
status.storage.topic=connect-status-test1
status.storage.replication.factor=1
#status.storage.partitions=5
# Flush much faster than normal, which is useful for testing/debugging
offset.flush.interval.ms=10000
rest.port=8083
plugin.path=/share/confluent/package/share/java
我在任何地方都看不到上述日志消息。任何帮助表示赞赏!
解决方案
推荐阅读
- python - 将 pandas df 导出到已包含格式的 excel 文件中?
- rest - 根据 openAPI 中的查询参数指定 RESTful API 响应
- reactjs - 更改 rowGroupPanelShow 状态后的 Aggrid 刷新
- c# - 使用 LINQ 进行列表比较时,C# 性能很慢
- java - 如何使用 Spock 在 LocalDate 中模拟静态方法?
- css - 粘性在引导列中不起作用
- java - graphql-java 中的性能问题,特别是 ExecutionStrategy#completeField() 和 ExecutionStrategy#fetchField()
- php - 使用会话值自动填充电子邮件字段 - Opencart 3.0.3.3
- azure - 使用 AJAX 表单后,任何用户都无法使用 Azure SSO 登录。可能 AJAX 表单对 App Pool 造成了问题(Asp.Net 4.7.2 MVC))
- python - 如何操作熊猫数据框行/标题?如何标注一行的价格是高于还是低于前一个价格?