• kafka log4j配置


    kafka日志文件分为5种类型,依次为:controller,kafka-request,server,state-change,log-cleaner,不同类型log数据,写到不同文件中:

    区别于config/server.properties中的log.dirs参数。

       1:  # Licensed to the Apache Software Foundation (ASF) under one or more
       2:  # contributor license agreements.  See the NOTICE file distributed with
       3:  # this work for additional information regarding copyright ownership.
       4:  # The ASF licenses this file to You under the Apache License, Version 2.0
       5:  # (the "License"); you may not use this file except in compliance with
       6:  # the License.  You may obtain a copy of the License at
       7:  #
       8:  #    http://www.apache.org/licenses/LICENSE-2.0
       9:  #
      10:  # Unless required by applicable law or agreed to in writing, software
      11:  # distributed under the License is distributed on an "AS IS" BASIS,
      12:  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13:  # See the License for the specific language governing permissions and
      14:  # limitations under the License.
      15:   
      16:  kafka.logs.dir=logs
      17:   
      18:  log4j.rootLogger=INFO, stdout 
      19:   
      20:  log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      21:  log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      22:  log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
      23:   
      24:  log4j.appender.kafkaAppender=org.apache.log4j.DailyRollingFileAppender
      25:  log4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH
      26:  log4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log
      27:  log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout
      28:  log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
      29:   
      30:  log4j.appender.stateChangeAppender=org.apache.log4j.DailyRollingFileAppender
      31:  log4j.appender.stateChangeAppender.DatePattern='.'yyyy-MM-dd-HH
      32:  log4j.appender.stateChangeAppender.File=${kafka.logs.dir}/state-change.log
      33:  log4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout
      34:  log4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
      35:   
      36:  log4j.appender.requestAppender=org.apache.log4j.DailyRollingFileAppender
      37:  log4j.appender.requestAppender.DatePattern='.'yyyy-MM-dd-HH
      38:  log4j.appender.requestAppender.File=${kafka.logs.dir}/kafka-request.log
      39:  log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout
      40:  log4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
      41:   
      42:  log4j.appender.cleanerAppender=org.apache.log4j.DailyRollingFileAppender
      43:  log4j.appender.cleanerAppender.DatePattern='.'yyyy-MM-dd-HH
      44:  log4j.appender.cleanerAppender.File=${kafka.logs.dir}/log-cleaner.log
      45:  log4j.appender.cleanerAppender.layout=org.apache.log4j.PatternLayout
      46:  log4j.appender.cleanerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
      47:   
      48:  log4j.appender.controllerAppender=org.apache.log4j.DailyRollingFileAppender
      49:  log4j.appender.controllerAppender.DatePattern='.'yyyy-MM-dd-HH
      50:  log4j.appender.controllerAppender.File=${kafka.logs.dir}/controller.log
      51:  log4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout
      52:  log4j.appender.controllerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
      53:   
      54:  # Turn on all our debugging info
      55:  #log4j.logger.kafka.producer.async.DefaultEventHandler=DEBUG, kafkaAppender
      56:  #log4j.logger.kafka.client.ClientUtils=DEBUG, kafkaAppender
      57:  #log4j.logger.kafka.perf=DEBUG, kafkaAppender
      58:  #log4j.logger.kafka.perf.ProducerPerformance$ProducerThread=DEBUG, kafkaAppender
      59:  #log4j.logger.org.I0Itec.zkclient.ZkClient=DEBUG
      60:  log4j.logger.kafka=INFO, kafkaAppender
      61:   
      62:  log4j.logger.kafka.network.RequestChannel$=WARN, requestAppender
      63:  log4j.additivity.kafka.network.RequestChannel$=false
      64:   
      65:  #log4j.logger.kafka.network.Processor=TRACE, requestAppender
      66:  #log4j.logger.kafka.server.KafkaApis=TRACE, requestAppender
      67:  #log4j.additivity.kafka.server.KafkaApis=false
      68:  log4j.logger.kafka.request.logger=WARN, requestAppender
      69:  log4j.additivity.kafka.request.logger=false
      70:   
      71:  log4j.logger.kafka.controller=TRACE, controllerAppender
      72:  log4j.additivity.kafka.controller=false
      73:   
      74:  log4j.logger.kafka.log.LogCleaner=INFO, cleanerAppender
      75:  log4j.additivity.kafka.log.LogCleaner=false
      76:   
      77:  log4j.logger.state.change.logger=TRACE, stateChangeAppender
      78:  log4j.additivity.state.change.logger=false

  • 相关阅读:
    php
    php
    linux 网络管理基础 OSI ISO IOS的区别
    Linux 添加交换分区的步骤
    linux 命令
    linux命令
    linux 命令
    linux 命令
    Linux命令
    linux命令- 挂载命令 mount
  • 原文地址:https://www.cnblogs.com/yinchengzhe/p/5111976.html
Copyright © 2020-2023  润新知