huwh commented on PR #22138:
URL: https://github.com/apache/flink/pull/22138#issuecomment-2408448977
> @huwh 感谢回复,环境如下: flink-kubernetes-operator 1.9.0 flink:
flink:1.18.1-scala_2.12 log4j-console.properties 是镜像默认的
>
> ```yaml
> apiVersion: flink.apache.org/v1beta1
> kind: FlinkDeployment
> metadata:
> name: basic
> spec:
> image: flink:1.18.1-scala_2.12
> flinkVersion: v1_18
> ingress:
> className: "nginx"
> template: "{{name}}.fo.xyuqing.com" # 引号必须有
> podTemplate:
> spec:
> containers:
> - name: flink-main-container
> ports:
> - name: metrics
> containerPort: 9249
> protocol: TCP
> env:
> - name: TZ # 设置容器运行的时区
> value: Asia/Shanghai
> flinkConfiguration:
> taskmanager.numberOfTaskSlots: "2"
> env.stdout-err.redirect-to-file: "true"
> metrics.reporter.prom.factory.class:
org.apache.flink.metrics.prometheus.PrometheusReporterFactory
> serviceAccount: flink
> jobManager:
> resource:
> cpu: 1
> memory: 2G
> taskManager:
> resource:
> cpu: 1
> memory: 2G
> job:
> jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar
> parallelism: 2
> upgradeMode: stateless
> ```
>
>

>
>

>
> 我的意思是虽然 `kubectl logs -f pods/xxx ` 不会打印log4j2的日志内容,但是对应的 `xxx.out`
文件还是包含有 log4j2 `xxx.log`的日志内容,最终导致 代码中的log4j的输出会存在两份,也就会占两份存储,而且`xxx.out`
文件不能做到按大小或时间自动切分
This is because flink-kubernetes-operator uses its log4j-console.properties,
which does not support the console appender filtering function.
Currently, flink-kubernetes-operator does not recommend enable
env.stdout-err.redirect-to-file, which does cause log duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]