@@ -163,6 +163,23 @@ static const struct config_enum_entry server_message_level_options[] = {
163
163
{NULL , 0 , false}
164
164
};
165
165
166
+ static const struct config_enum_entry backtrace_level_options [] = {
167
+ {"debug5" , DEBUG5 , false},
168
+ {"debug4" , DEBUG4 , false},
169
+ {"debug3" , DEBUG3 , false},
170
+ {"debug2" , DEBUG2 , false},
171
+ {"debug1" , DEBUG1 , false},
172
+ {"debug" , DEBUG2 , true},
173
+ {"log" , LOG , false},
174
+ {"info" , INFO , true},
175
+ {"notice" , NOTICE , false},
176
+ {"warning" , WARNING , false},
177
+ {"error" , ERROR , false},
178
+ {"fatal" , FATAL , false},
179
+ {"panic" , PANIC , false},
180
+ {NULL , 0 , false}
181
+ };
182
+
166
183
static const struct config_enum_entry intervalstyle_options [] = {
167
184
{"postgres" , INTSTYLE_POSTGRES , false},
168
185
{"postgres_verbose" , INTSTYLE_POSTGRES_VERBOSE , false},
@@ -200,6 +217,16 @@ static const struct config_enum_entry log_error_verbosity_options[] = {
200
217
StaticAssertDecl (lengthof (log_error_verbosity_options ) == (PGERROR_VERBOSE + 2 ),
201
218
"array length mismatch" );
202
219
220
+ static const struct config_enum_entry log_backtrace_options [] = {
221
+ {"none" , LOGBACKTRACE_NONE , false},
222
+ {"internal_error" , LOGBACKTRACE_INTERNAL_ERROR , false},
223
+ {"all" , LOGBACKTRACE_ALL , false},
224
+ {NULL , 0 , false}
225
+ };
226
+
227
+ StaticAssertDecl (lengthof (log_backtrace_options ) == (LOGBACKTRACE_ALL + 2 ),
228
+ "array length mismatch" );
229
+
203
230
static const struct config_enum_entry log_statement_options [] = {
204
231
{"none" , LOGSTMT_NONE , false},
205
232
{"ddl" , LOGSTMT_DDL , false},
@@ -546,6 +573,7 @@ int log_temp_files = -1;
546
573
double log_statement_sample_rate = 1.0 ;
547
574
double log_xact_sample_rate = 0 ;
548
575
char * backtrace_functions ;
576
+ int backtrace_min_level = ERROR ;
549
577
550
578
int temp_file_limit = -1 ;
551
579
@@ -5004,6 +5032,18 @@ struct config_enum ConfigureNamesEnum[] =
5004
5032
NULL , NULL , NULL
5005
5033
},
5006
5034
5035
+ {
5036
+ {"backtrace_min_level" , PGC_SUSET , DEVELOPER_OPTIONS ,
5037
+ gettext_noop ("Sets the message levels that create backtraces when log_backtrace is configured." ),
5038
+ gettext_noop ("Each level includes all the levels that follow it. The later"
5039
+ " the level, the fewer backtraces are created." ),
5040
+ GUC_NOT_IN_SAMPLE
5041
+ },
5042
+ & backtrace_min_level ,
5043
+ ERROR , backtrace_level_options ,
5044
+ NULL , NULL , NULL
5045
+ },
5046
+
5007
5047
{
5008
5048
{"bytea_output" , PGC_USERSET , CLIENT_CONN_STATEMENT ,
5009
5049
gettext_noop ("Sets the output format for bytea." ),
@@ -5100,6 +5140,16 @@ struct config_enum ConfigureNamesEnum[] =
5100
5140
NULL , NULL , NULL
5101
5141
},
5102
5142
5143
+ {
5144
+ {"log_backtrace" , PGC_SUSET , LOGGING_WHAT ,
5145
+ gettext_noop ("Sets if logs should include a backtrace." ),
5146
+ NULL
5147
+ },
5148
+ & log_backtrace ,
5149
+ LOGBACKTRACE_NONE , log_backtrace_options ,
5150
+ NULL , NULL , NULL
5151
+ },
5152
+
5103
5153
{
5104
5154
{"log_error_verbosity" , PGC_SUSET , LOGGING_WHAT ,
5105
5155
gettext_noop ("Sets the verbosity of logged messages." ),
0 commit comments