Configuration:
  status: WARN
  
  Properties:
    Property:
      - name: LOG_DIR
        value: "${sys:gateway.log.dir:-logs}"
      - name: LOG_REDACTOR_RULES
        value: "${sys:gateway.log.redactor.rules:-${env:GATEWAY_LOG_REDACTOR_RULES:-config/log-redactor-rules.json}}"
  
  Appenders:
    # Console Appender
    Console:
      name: Console
      target: SYSTEM_OUT
      PatternLayout:
        pattern: "%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} [%t] - %msg%n"
    
    # Main application log file
    RollingFile:
      - name: File
        fileName: "${LOG_DIR}/gateway.log"
        filePattern: "${LOG_DIR}/gateway.log.%i"
        PatternLayout:
          pattern: "%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} [%t] - %msg%n"
        Policies:
          SizeBasedTriggeringPolicy:
            size: 100MB
        DefaultRolloverStrategy:
          max: 10

    # Log Redactor wrapping Console and File appenders
    Rewrite:
      - name: Redactor
        RedactorPolicy:
          name: "io.confluent.log4j2.redactor.RedactorPolicy"
          rules: "${LOG_REDACTOR_RULES}"
        AppenderRef:
          - ref: Console
          - ref: File
  
  Loggers:
    # Gateway specific loggers
    Logger:
      - name: io.confluent.gateway
        level: "${env:GATEWAY_LOG_LEVEL:-${env:GATEWAY_ROOT_LOG_LEVEL:-INFO}}"
        additivity: false
        AppenderRef:
          - ref: Redactor
      
      # Kroxylicious loggers
      - name: io.kroxylicious
        level: "${env:KROXYLICIOUS_LOG_LEVEL:-${env:GATEWAY_ROOT_LOG_LEVEL:-INFO}}"
        additivity: false
        AppenderRef:
          - ref: Redactor
      
      # Third party loggers
      - name: org.apache.kafka
        level: "${env:KAFKA_LOG_LEVEL:-${env:GATEWAY_ROOT_LOG_LEVEL:-WARN}}"
        additivity: false
        AppenderRef:
          - ref: Redactor
      - name: org.eclipse.jetty
        level: "${env:JETTY_LOG_LEVEL:-${env:GATEWAY_ROOT_LOG_LEVEL:-WARN}}"
        additivity: false
        AppenderRef:
          - ref: Redactor
      - name: io.netty
        level: "${env:NETTY_LOG_LEVEL:-${env:GATEWAY_ROOT_LOG_LEVEL:-WARN}}"
        additivity: false
        AppenderRef:
          - ref: Redactor
    
    # Root Logger
    Root:
      level: "${env:GATEWAY_ROOT_LOG_LEVEL:-INFO}"
      additivity: false
      AppenderRef:
        - ref: Redactor
