Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opt](log) refine the FE logger #35679

Merged
merged 14 commits into from
Jun 4, 2024
Merged

[opt](log) refine the FE logger #35679

merged 14 commits into from
Jun 4, 2024

Conversation

morningman
Copy link
Contributor

@morningman morningman commented May 30, 2024

Background

Previously, FE logs were written to files. The main FE logs include fe.log, fe.warn.log, fe.audit.log, fe.out, and fe.gc.log.
In a K8s deployment environment, logs usually need to be output to standard output, and then other components process the log stream.

Solution

This PR made the following changes:

  1. Modified the log4j configuration template

    • When started with --daemon, logs are still written to various files, and the format remains unchanged.

    • When started with --console, all logs are output to standard output and marked with different prefixes:

      • StdoutLogger: logs for standard output
      • StderrLogger: logs for standard error output
      • RuntimeLogger: logs for fe.log or fe.warn.log
      • AuditLogger: logs for fe.audit.log
      • No prefix: logs for fe.gc.log

      Examples are as follows:

       RuntimeLogger 2024-06-03 14:54:51,229 INFO (binlog-gcer|62) [BinlogManager.gc():359] begin gc binlog
      
  2. Added a new FE config: enable_file_logger

    Defaults to true. Indicates that logs will be recorded to files regardless of the startup method. For example, if it is started with --console, the log will be output to both the file and the standard output. If it is false, the log will not be recorded in the file regardless of the startup method.

  3. Optimized the log format of standard output

    The byte streams of stdout and stderr are captured. The logs previously outputted using System.out will be captured in fe.log for unified management.

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In bin/start_fe.sh line 252:
CUR_DATE=`date`
         ^----^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
CUR_DATE=$(date)

For more information:
  https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt ' returned error 1 finding the following formatting issues:

----------
--- bin/start_fe.sh.orig
+++ bin/start_fe.sh
@@ -181,11 +181,10 @@
     if [[ "${RUN_CONSOLE}" -eq 1 ]]; then
         echo "$1"
     else
-        echo "$1" >> "${STDOUT_LOGGER}"
+        echo "$1" >>"${STDOUT_LOGGER}"
     fi
 }
 
-
 # check java version and choose correct JAVA_OPTS
 java_version="$(
     set -e
@@ -249,7 +248,7 @@
     coverage_opt="${JACOCO_COVERAGE_OPT}"
 fi
 
-CUR_DATE=`date`
+CUR_DATE=$(date)
 log "start time: ${CUR_DATE}"
 
 if [[ "${HELPER}" != "" ]]; then
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt  -w filename


Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In bin/start_fe.sh line 252:
CUR_DATE=`date`
         ^----^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
CUR_DATE=$(date)

For more information:
  https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt ' returned error 1 finding the following formatting issues:

----------
--- bin/start_fe.sh.orig
+++ bin/start_fe.sh
@@ -181,11 +181,10 @@
     if [[ "${RUN_CONSOLE}" -eq 1 ]]; then
         echo "$1"
     else
-        echo "$1" >> "${STDOUT_LOGGER}"
+        echo "$1" >>"${STDOUT_LOGGER}"
     fi
 }
 
-
 # check java version and choose correct JAVA_OPTS
 java_version="$(
     set -e
@@ -249,7 +248,7 @@
     coverage_opt="${JACOCO_COVERAGE_OPT}"
 fi
 
-CUR_DATE=`date`
+CUR_DATE=$(date)
 log "start time: ${CUR_DATE}"
 
 if [[ "${HELPER}" != "" ]]; then
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt  -w filename


Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In bin/start_fe.sh line 252:
CUR_DATE=`date`
         ^----^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
CUR_DATE=$(date)

For more information:
  https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt ' returned error 1 finding the following formatting issues:

----------
--- bin/start_fe.sh.orig
+++ bin/start_fe.sh
@@ -181,11 +181,10 @@
     if [[ "${RUN_CONSOLE}" -eq 1 ]]; then
         echo "$1"
     else
-        echo "$1" >> "${STDOUT_LOGGER}"
+        echo "$1" >>"${STDOUT_LOGGER}"
     fi
 }
 
-
 # check java version and choose correct JAVA_OPTS
 java_version="$(
     set -e
@@ -249,7 +248,7 @@
     coverage_opt="${JACOCO_COVERAGE_OPT}"
 fi
 
-CUR_DATE=`date`
+CUR_DATE=$(date)
 log "start time: ${CUR_DATE}"
 
 if [[ "${HELPER}" != "" ]]; then
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt  -w filename


@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 41258 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit fa26ae98acacb616f910ff64c2103ea085bd2efa, data reload: false

------ Round 1 ----------------------------------
q1	17612	4377	4268	4268
q2	2014	195	187	187
q3	10461	1220	1241	1220
q4	10187	778	786	778
q5	7477	2690	2693	2690
q6	228	134	137	134
q7	959	617	608	608
q8	9233	2201	2094	2094
q9	9727	6690	6700	6690
q10	9661	3892	3901	3892
q11	455	241	240	240
q12	500	236	240	236
q13	17357	3182	3249	3182
q14	268	240	218	218
q15	509	471	478	471
q16	471	400	392	392
q17	990	688	741	688
q18	8365	7775	7716	7716
q19	5566	1631	1608	1608
q20	648	313	310	310
q21	5200	3307	4067	3307
q22	394	333	329	329
Total cold run time: 118282 ms
Total hot run time: 41258 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4560	4395	4429	4395
q2	373	279	265	265
q3	3125	2957	2911	2911
q4	1931	1614	1571	1571
q5	5364	5541	5480	5480
q6	210	125	127	125
q7	2134	1769	1783	1769
q8	3229	3431	3337	3337
q9	8536	8646	8627	8627
q10	4109	3785	3803	3785
q11	608	511	496	496
q12	786	633	639	633
q13	17107	3204	3211	3204
q14	290	275	299	275
q15	542	505	488	488
q16	494	445	438	438
q17	1830	1507	1508	1507
q18	7687	7492	7459	7459
q19	2061	1583	1560	1560
q20	1998	1793	1821	1793
q21	9954	4689	4908	4689
q22	592	527	513	513
Total cold run time: 77520 ms
Total hot run time: 55320 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 168703 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit fa26ae98acacb616f910ff64c2103ea085bd2efa, data reload: false

query1	941	384	366	366
query2	6447	2386	2434	2386
query3	6645	208	207	207
query4	19489	17450	17288	17288
query5	4150	424	409	409
query6	242	154	146	146
query7	4575	296	294	294
query8	327	291	302	291
query9	8598	2377	2371	2371
query10	441	289	256	256
query11	10788	10332	10266	10266
query12	133	87	92	87
query13	1637	369	355	355
query14	9332	6707	6743	6707
query15	238	188	182	182
query16	7603	262	264	262
query17	1326	542	496	496
query18	1891	273	268	268
query19	207	156	148	148
query20	99	83	85	83
query21	198	137	135	135
query22	4348	3923	3878	3878
query23	33633	32921	32654	32654
query24	8692	2831	2908	2831
query25	565	343	357	343
query26	709	154	154	154
query27	2221	309	332	309
query28	5744	2041	2069	2041
query29	849	605	599	599
query30	259	149	151	149
query31	960	794	731	731
query32	92	53	54	53
query33	617	259	263	259
query34	892	470	465	465
query35	744	606	603	603
query36	1075	897	899	897
query37	105	70	66	66
query38	2869	2809	2751	2751
query39	884	795	789	789
query40	193	123	121	121
query41	53	50	51	50
query42	104	99	92	92
query43	621	564	564	564
query44	1076	717	740	717
query45	194	173	170	170
query46	1062	755	709	709
query47	1856	1790	1789	1789
query48	373	300	299	299
query49	886	389	400	389
query50	767	386	376	376
query51	6815	6601	6725	6601
query52	96	87	90	87
query53	354	293	296	293
query54	727	425	431	425
query55	70	74	71	71
query56	262	235	258	235
query57	1136	1040	1038	1038
query58	232	217	214	214
query59	3610	3341	3157	3157
query60	269	255	262	255
query61	90	88	87	87
query62	595	433	454	433
query63	317	283	291	283
query64	8563	2193	1712	1712
query65	3166	3087	3108	3087
query66	792	323	326	323
query67	14999	14731	14626	14626
query68	4467	526	520	520
query69	434	277	278	277
query70	1116	1077	1107	1077
query71	375	325	269	269
query72	7245	5442	2745	2745
query73	706	326	315	315
query74	6063	5689	5640	5640
query75	3326	2629	2634	2629
query76	2293	964	946	946
query77	380	264	270	264
query78	10461	9851	9749	9749
query79	2275	513	521	513
query80	1016	445	426	426
query81	546	220	221	220
query82	672	93	98	93
query83	243	170	167	167
query84	243	85	83	83
query85	1736	267	256	256
query86	534	308	300	300
query87	3347	3167	3106	3106
query88	4337	2327	2347	2327
query89	471	380	457	380
query90	2036	184	188	184
query91	122	107	93	93
query92	58	48	46	46
query93	1989	502	481	481
query94	1287	190	188	188
query95	406	305	311	305
query96	597	260	270	260
query97	3178	3013	3010	3010
query98	243	224	217	217
query99	1121	839	862	839
Total cold run time: 263166 ms
Total hot run time: 168703 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.74 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit fa26ae98acacb616f910ff64c2103ea085bd2efa, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.05	0.05
query4	1.67	0.08	0.08
query5	0.50	0.48	0.49
query6	1.14	0.73	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.05
query9	0.52	0.49	0.50
query10	0.55	0.55	0.54
query11	0.17	0.11	0.11
query12	0.15	0.12	0.12
query13	0.60	0.59	0.60
query14	0.78	0.78	0.76
query15	0.82	0.81	0.81
query16	0.35	0.37	0.37
query17	1.02	1.02	1.02
query18	0.23	0.22	0.26
query19	1.83	1.65	1.75
query20	0.01	0.01	0.01
query21	15.84	0.71	0.68
query22	4.89	7.04	2.05
query23	18.26	1.34	1.32
query24	1.57	0.24	0.26
query25	0.14	0.09	0.08
query26	0.26	0.17	0.17
query27	0.07	0.07	0.08
query28	13.40	1.00	0.98
query29	13.23	3.25	3.23
query30	0.24	0.06	0.06
query31	2.86	0.39	0.39
query32	3.32	0.48	0.46
query33	2.87	2.89	2.90
query34	17.20	4.44	4.50
query35	4.52	4.51	4.69
query36	0.65	0.47	0.46
query37	0.18	0.15	0.15
query38	0.15	0.14	0.14
query39	0.04	0.04	0.03
query40	0.17	0.13	0.15
query41	0.10	0.05	0.04
query42	0.06	0.04	0.06
query43	0.04	0.04	0.04
Total cold run time: 110.82 s
Total hot run time: 30.74 s

@morningman morningman changed the title [opt](log) refine the logger [opt](log) refine the FE logger Jun 3, 2024
@morningman morningman marked this pull request as ready for review June 3, 2024 07:12
@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 41472 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit fc7bb66f4c5094c8674ad6afaa018292ec82f2be, data reload: false

------ Round 1 ----------------------------------
q1	17604	4350	4272	4272
q2	2022	190	194	190
q3	10459	1225	1125	1125
q4	10207	857	787	787
q5	7493	2713	2678	2678
q6	227	134	138	134
q7	958	617	623	617
q8	9232	2132	2094	2094
q9	9223	6674	6715	6674
q10	9103	3956	3899	3899
q11	475	235	248	235
q12	456	233	241	233
q13	18355	3242	3161	3161
q14	260	221	237	221
q15	513	481	484	481
q16	526	404	390	390
q17	1022	653	675	653
q18	8416	7734	7895	7734
q19	8455	1296	1213	1213
q20	664	320	314	314
q21	5039	4030	4093	4030
q22	407	337	350	337
Total cold run time: 121116 ms
Total hot run time: 41472 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4502	4467	4489	4467
q2	363	277	267	267
q3	3139	2932	2911	2911
q4	2031	1647	1616	1616
q5	5342	5518	5468	5468
q6	223	127	128	127
q7	2158	1783	1806	1783
q8	3232	3335	3404	3335
q9	8650	8558	8596	8558
q10	4099	3873	3844	3844
q11	585	498	501	498
q12	755	614	602	602
q13	16672	3058	3127	3058
q14	300	272	262	262
q15	518	490	486	486
q16	475	440	433	433
q17	1819	1523	1516	1516
q18	7908	7638	7292	7292
q19	1772	1584	1599	1584
q20	3020	1794	1791	1791
q21	5042	4759	4653	4653
q22	681	562	554	554
Total cold run time: 73286 ms
Total hot run time: 55105 ms

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 3, 2024
Copy link
Contributor

github-actions bot commented Jun 3, 2024

PR approved by at least one committer and no changes requested.

Copy link
Contributor

github-actions bot commented Jun 3, 2024

PR approved by anyone and no changes requested.

@doris-robot
Copy link

TPC-DS: Total hot run time: 170015 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit fc7bb66f4c5094c8674ad6afaa018292ec82f2be, data reload: false

query1	916	385	374	374
query2	6460	2352	2280	2280
query3	6634	202	205	202
query4	18838	17594	17163	17163
query5	4193	449	437	437
query6	252	179	154	154
query7	4574	300	289	289
query8	323	277	274	274
query9	8629	2405	2387	2387
query10	444	297	280	280
query11	10363	10104	10096	10096
query12	143	89	94	89
query13	1643	376	372	372
query14	9125	7760	7560	7560
query15	229	185	184	184
query16	7833	260	271	260
query17	1556	548	513	513
query18	1941	266	273	266
query19	198	155	149	149
query20	92	86	87	86
query21	208	140	125	125
query22	4207	4282	4088	4088
query23	33580	32968	33543	32968
query24	11100	2845	2724	2724
query25	604	348	356	348
query26	1216	154	164	154
query27	2771	333	330	330
query28	7454	2085	2064	2064
query29	885	615	634	615
query30	283	146	151	146
query31	947	745	734	734
query32	97	51	52	51
query33	753	285	274	274
query34	984	461	467	461
query35	711	617	601	601
query36	1084	935	922	922
query37	159	70	67	67
query38	2828	2728	2727	2727
query39	859	778	792	778
query40	203	123	121	121
query41	54	51	55	51
query42	118	96	98	96
query43	602	513	540	513
query44	1234	714	732	714
query45	195	168	162	162
query46	1064	710	709	709
query47	1883	1797	1747	1747
query48	361	296	317	296
query49	989	406	417	406
query50	783	387	393	387
query51	6769	6766	6928	6766
query52	99	90	88	88
query53	358	280	284	280
query54	865	444	430	430
query55	75	71	73	71
query56	271	250	252	250
query57	1142	1021	1021	1021
query58	273	246	234	234
query59	3495	3221	3165	3165
query60	295	266	273	266
query61	92	91	109	91
query62	675	459	455	455
query63	319	285	288	285
query64	8845	2204	1734	1734
query65	3190	3098	3109	3098
query66	808	329	331	329
query67	15321	14716	14907	14716
query68	4504	536	523	523
query69	449	284	329	284
query70	1090	1164	1120	1120
query71	389	289	280	280
query72	7282	5546	2749	2749
query73	736	320	324	320
query74	5828	5525	5517	5517
query75	3306	2616	2669	2616
query76	2541	905	855	855
query77	456	299	284	284
query78	10248	9976	9835	9835
query79	1629	509	515	509
query80	2473	461	455	455
query81	596	223	223	223
query82	1043	106	95	95
query83	304	169	166	166
query84	268	96	88	88
query85	1192	277	270	270
query86	442	315	305	305
query87	3290	3043	3109	3043
query88	3217	2352	2392	2352
query89	486	387	382	382
query90	1794	190	181	181
query91	122	98	93	93
query92	65	48	50	48
query93	1544	514	504	504
query94	1247	193	184	184
query95	412	317	313	313
query96	580	268	267	267
query97	3163	3041	3039	3039
query98	241	215	216	215
query99	1153	827	835	827
Total cold run time: 267584 ms
Total hot run time: 170015 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.7 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit fc7bb66f4c5094c8674ad6afaa018292ec82f2be, data reload: false

query1	0.04	0.03	0.03
query2	0.09	0.04	0.04
query3	0.23	0.05	0.05
query4	1.67	0.07	0.06
query5	0.50	0.48	0.49
query6	1.13	0.73	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.05
query9	0.54	0.49	0.49
query10	0.54	0.54	0.55
query11	0.15	0.12	0.11
query12	0.14	0.11	0.12
query13	0.58	0.59	0.59
query14	0.77	0.77	0.78
query15	0.82	0.81	0.82
query16	0.37	0.35	0.35
query17	1.04	0.95	1.01
query18	0.22	0.26	0.21
query19	1.73	1.77	1.69
query20	0.02	0.01	0.01
query21	15.72	0.64	0.64
query22	4.59	6.04	2.07
query23	18.28	1.32	1.30
query24	1.90	0.24	0.19
query25	0.15	0.08	0.08
query26	0.27	0.18	0.17
query27	0.08	0.08	0.07
query28	13.35	1.00	0.99
query29	13.13	3.40	3.33
query30	0.23	0.07	0.05
query31	2.86	0.39	0.40
query32	3.27	0.47	0.47
query33	2.91	2.92	2.91
query34	17.10	4.51	4.46
query35	4.49	4.44	4.47
query36	0.70	0.52	0.49
query37	0.18	0.16	0.16
query38	0.16	0.15	0.14
query39	0.04	0.03	0.04
query40	0.17	0.14	0.14
query41	0.09	0.05	0.04
query42	0.05	0.05	0.04
query43	0.04	0.04	0.04
Total cold run time: 110.41 s
Total hot run time: 30.7 s

@morningman morningman merged commit 41e495e into apache:master Jun 4, 2024
27 of 29 checks passed
dataroaring pushed a commit that referenced this pull request Jun 4, 2024
## Backgroup

Previously, FE logs were written to files. The main FE logs include
fe.log, fe.warn.log, fe.audit.log, fe.out, and fe.gc.log.
In a K8s deployment environment, logs usually need to be output to
standard output, and then other components process the log stream.

## Solution

This PR made the following changes:

1. Modified the log4j configuration template

- When started with `--daemon`, logs are still written to various files,
and the format remains unchanged.
- When started with `--console`, all logs are output to standard output
and marked with different prefixes:
	
		- `StdoutLogger`: logs for standard output
		- `StderrLogger`: logs for standard error output
		- `RuntimeLogger`: logs for fe.log or fe.warn.log
		- `AuditLogger:` logs for fe.audit.log
		- No prefix: logs for fe.gc.log
		
		Examples are as follows:
		
		```
RuntimeLogger 2024-06-03 14:54:51,229 INFO (binlog-gcer|62)
[BinlogManager.gc():359] begin gc binlog
		```

2. Added a new FE config: `enable_file_logger`

Defaults to true. Indicates that logs will be recorded to files
regardless of the startup method. For example, if it is started with
`--console`, the log will be output to both the file and the standard
output. If it is `false`, the log will not be recorded in the file
regardless of the startup method.

3. Optimized the log format of standard output

The byte streams of stdout and stderr are captured. The logs previously
outputted using `System.out` will be captured in fe.log for unified
management.
morningman added a commit to morningman/doris that referenced this pull request Jun 4, 2024
Previously, FE logs were written to files. The main FE logs include
fe.log, fe.warn.log, fe.audit.log, fe.out, and fe.gc.log.
In a K8s deployment environment, logs usually need to be output to
standard output, and then other components process the log stream.

This PR made the following changes:

1. Modified the log4j configuration template

- When started with `--daemon`, logs are still written to various files,
and the format remains unchanged.
- When started with `--console`, all logs are output to standard output
and marked with different prefixes:

		- `StdoutLogger`: logs for standard output
		- `StderrLogger`: logs for standard error output
		- `RuntimeLogger`: logs for fe.log or fe.warn.log
		- `AuditLogger:` logs for fe.audit.log
		- No prefix: logs for fe.gc.log

		Examples are as follows:

		```
RuntimeLogger 2024-06-03 14:54:51,229 INFO (binlog-gcer|62)
[BinlogManager.gc():359] begin gc binlog
		```

2. Added a new FE config: `enable_file_logger`

Defaults to true. Indicates that logs will be recorded to files
regardless of the startup method. For example, if it is started with
`--console`, the log will be output to both the file and the standard
output. If it is `false`, the log will not be recorded in the file
regardless of the startup method.

3. Optimized the log format of standard output

The byte streams of stdout and stderr are captured. The logs previously
outputted using `System.out` will be captured in fe.log for unified
management.
seawinde pushed a commit to seawinde/doris that referenced this pull request Jun 5, 2024
## Backgroup

Previously, FE logs were written to files. The main FE logs include
fe.log, fe.warn.log, fe.audit.log, fe.out, and fe.gc.log.
In a K8s deployment environment, logs usually need to be output to
standard output, and then other components process the log stream.

## Solution

This PR made the following changes:

1. Modified the log4j configuration template

- When started with `--daemon`, logs are still written to various files,
and the format remains unchanged.
- When started with `--console`, all logs are output to standard output
and marked with different prefixes:
	
		- `StdoutLogger`: logs for standard output
		- `StderrLogger`: logs for standard error output
		- `RuntimeLogger`: logs for fe.log or fe.warn.log
		- `AuditLogger:` logs for fe.audit.log
		- No prefix: logs for fe.gc.log
		
		Examples are as follows:
		
		```
RuntimeLogger 2024-06-03 14:54:51,229 INFO (binlog-gcer|62)
[BinlogManager.gc():359] begin gc binlog
		```

2. Added a new FE config: `enable_file_logger`

Defaults to true. Indicates that logs will be recorded to files
regardless of the startup method. For example, if it is started with
`--console`, the log will be output to both the file and the standard
output. If it is `false`, the log will not be recorded in the file
regardless of the startup method.

3. Optimized the log format of standard output

The byte streams of stdout and stderr are captured. The logs previously
outputted using `System.out` will be captured in fe.log for unified
management.
morningman added a commit that referenced this pull request Jun 6, 2024
Followup #35679

## Background

Previously, BE logs were written to files. The main FE logs include
be.INFO, be.WARNING, be.out, be.gc.log and jni.log.
In a K8s deployment environment, logs usually need to be output to
standard output, and then other components process the log stream.

## Solution

This PR made the following changes:

1. Modified the glog config:

- When started with `--daemon`, logs are still written to various files,
and the format remains unchanged.
- When started with `--console`, be.INFO's log is output to standard
output and marked with prefix `RuntimeLogger`.
		
		Examples are as follows:
		
		```
RuntimeLogger I20240605 23:41:20.426553 4137369
runtime_query_statistics_mgr.cpp:245] Report profile thread stopped
		```

2. Added a new BE config: `enable_file_logger`

Defaults to true. Indicates that logs will be recorded to files
regardless of the startup method. For example, if it is started with
`--console`, the log will be output to both the file and the standard
output. If it is `false`, the log will not be recorded in the file
regardless of the startup method.

## TODO

- Need to handle jni.log in next PR
morningman added a commit to morningman/doris that referenced this pull request Jun 6, 2024
Followup apache#35679

Previously, BE logs were written to files. The main FE logs include
be.INFO, be.WARNING, be.out, be.gc.log and jni.log.
In a K8s deployment environment, logs usually need to be output to
standard output, and then other components process the log stream.

This PR made the following changes:

1. Modified the glog config:

- When started with `--daemon`, logs are still written to various files,
and the format remains unchanged.
- When started with `--console`, be.INFO's log is output to standard
output and marked with prefix `RuntimeLogger`.

		Examples are as follows:

		```
RuntimeLogger I20240605 23:41:20.426553 4137369
runtime_query_statistics_mgr.cpp:245] Report profile thread stopped
		```

2. Added a new BE config: `enable_file_logger`

Defaults to true. Indicates that logs will be recorded to files
regardless of the startup method. For example, if it is started with
`--console`, the log will be output to both the file and the standard
output. If it is `false`, the log will not be recorded in the file
regardless of the startup method.

- Need to handle jni.log in next PR
dataroaring pushed a commit that referenced this pull request Jun 7, 2024
Followup #35679

## Background

Previously, BE logs were written to files. The main FE logs include
be.INFO, be.WARNING, be.out, be.gc.log and jni.log.
In a K8s deployment environment, logs usually need to be output to
standard output, and then other components process the log stream.

## Solution

This PR made the following changes:

1. Modified the glog config:

- When started with `--daemon`, logs are still written to various files,
and the format remains unchanged.
- When started with `--console`, be.INFO's log is output to standard
output and marked with prefix `RuntimeLogger`.
		
		Examples are as follows:
		
		```
RuntimeLogger I20240605 23:41:20.426553 4137369
runtime_query_statistics_mgr.cpp:245] Report profile thread stopped
		```

2. Added a new BE config: `enable_file_logger`

Defaults to true. Indicates that logs will be recorded to files
regardless of the startup method. For example, if it is started with
`--console`, the log will be output to both the file and the standard
output. If it is `false`, the log will not be recorded in the file
regardless of the startup method.

## TODO

- Need to handle jni.log in next PR
@@ -105,8 +105,7 @@ public void setup(File envHome, String selfNodeName, String selfNodeHostPort,
DbResetRepGroup resetUtility = new DbResetRepGroup(
envHome, PALO_JOURNAL_GROUP, selfNodeName, selfNodeHostPort);
resetUtility.reset();
LOG.warn("WARNING: metadata recovery mode, group has been reset.");
System.out.println("WARNING: metadata recovery mode, group has been reset.");
LOG.warn("metadata recovery mode, group has been reset.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing this type of log to stdout is critical for troubleshooting.

@@ -446,8 +446,7 @@ public static void loadJournal(Env env, Long logId, JournalEntity journal) {
Frontend fe = (Frontend) journal.getData();
env.replayDropFrontend(fe);
if (fe.getNodeName().equals(Env.getCurrentEnv().getNodeName())) {
System.out.println("current fe " + fe + " is removed. will exit");
LOG.info("current fe " + fe + " is removed. will exit");
LOG.warn("current fe {} is removed. will exit", fe);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem

@morningman morningman mentioned this pull request Jun 22, 2024
w41ter added a commit that referenced this pull request Aug 20, 2024
Followup #35679 and #24556

# Background

Previously, the cloud logs were written to files. The main cloud logs
include meta_service.INFO and meta_service.WARNING, doris_cloud.out.
In a K8s deployment environment, logs usually must be output to standard
output, and other components process the log stream.

# Solution
This PR made the following changes:

Modified the glog config:

- When started with --daemon, logs are still written to various files,
and the format remains unchanged.

- When started with --console, meta_service.INFO's log is output to
standard output and marked with the prefix RuntimeLogger.

Examples are as follows:

```
 RuntimeLogger I20240605 23:41:20.426553 4137369 runtime_query_statistics_mgr.cpp:245] Report profile thread stopped
```

Added a new cloud config: `enable_file_logger`, which defaults to true.
This indicates that logs will be recorded in files regardless of the
startup method. For example, if it is started with `--console`, the log
will be output to both the file and the standard output. If it is false,
the log will not be recorded in the file regardless of the startup
method.
dataroaring pushed a commit that referenced this pull request Aug 22, 2024
Followup #35679 and #24556

# Background

Previously, the cloud logs were written to files. The main cloud logs
include meta_service.INFO and meta_service.WARNING, doris_cloud.out.
In a K8s deployment environment, logs usually must be output to standard
output, and other components process the log stream.

# Solution
This PR made the following changes:

Modified the glog config:

- When started with --daemon, logs are still written to various files,
and the format remains unchanged.

- When started with --console, meta_service.INFO's log is output to
standard output and marked with the prefix RuntimeLogger.

Examples are as follows:

```
 RuntimeLogger I20240605 23:41:20.426553 4137369 runtime_query_statistics_mgr.cpp:245] Report profile thread stopped
```

Added a new cloud config: `enable_file_logger`, which defaults to true.
This indicates that logs will be recorded in files regardless of the
startup method. For example, if it is started with `--console`, the log
will be output to both the file and the standard output. If it is false,
the log will not be recorded in the file regardless of the startup
method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants