Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f39df967
Commit
f39df967
authored
Jul 03, 2009
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add log_line_prefix placeholder %e to contain the current SQL state
Author: Guillaume Smet <guillaume.smet@gmail.com>
parent
e2b42aef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
doc/src/sgml/config.sgml
doc/src/sgml/config.sgml
+6
-1
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+15
-12
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/misc/postgresql.conf.sample
+1
-0
No files found.
doc/src/sgml/config.sgml
View file @
f39df967
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.22
0 2009/06/17 21:58:48 tgl
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.22
1 2009/07/03 19:14:25 petere
Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
...
...
@@ -3043,6 +3043,11 @@ local0.* /var/log/postgresql
<entry>Command tag: type of session's current command</entry>
<entry>yes</entry>
</row>
<row>
<entry><literal>%e</literal></entry>
<entry>SQL state</entry>
<entry>no</entry>
</row>
<row>
<entry><literal>%c</literal></entry>
<entry>Session ID: see below</entry>
...
...
src/backend/utils/error/elog.c
View file @
f39df967
...
...
@@ -42,7 +42,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.21
6 2009/06/25 23:07:15 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.21
7 2009/07/03 19:14:25 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -144,7 +144,7 @@ static char formatted_log_time[FORMATTED_TS_LEN];
} while (0)
static
void
log_line_prefix
(
StringInfo
buf
);
static
void
log_line_prefix
(
StringInfo
buf
,
ErrorData
*
edata
);
static
void
send_message_to_server_log
(
ErrorData
*
edata
);
static
void
send_message_to_frontend
(
ErrorData
*
edata
);
static
char
*
expand_fmt_string
(
const
char
*
fmt
,
ErrorData
*
edata
);
...
...
@@ -1677,7 +1677,7 @@ setup_formatted_start_time(void)
* Format tag info for log lines; append to the provided buffer.
*/
static
void
log_line_prefix
(
StringInfo
buf
)
log_line_prefix
(
StringInfo
buf
,
ErrorData
*
edata
)
{
/* static counter for line numbers */
static
long
log_line_number
=
0
;
...
...
@@ -1814,6 +1814,9 @@ log_line_prefix(StringInfo buf)
case
'x'
:
appendStringInfo
(
buf
,
"%u"
,
GetTopTransactionIdIfAny
());
break
;
case
'e'
:
appendStringInfoString
(
buf
,
unpack_sql_state
(
edata
->
sqlerrcode
));
break
;
case
'%'
:
appendStringInfoChar
(
buf
,
'%'
);
break
;
...
...
@@ -2070,7 +2073,7 @@ send_message_to_server_log(ErrorData *edata)
formatted_log_time
[
0
]
=
'\0'
;
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfo
(
&
buf
,
"%s: "
,
error_severity
(
edata
->
elevel
));
if
(
Log_error_verbosity
>=
PGERROR_VERBOSE
)
...
...
@@ -2094,35 +2097,35 @@ send_message_to_server_log(ErrorData *edata)
{
if
(
edata
->
detail_log
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfoString
(
&
buf
,
_
(
"DETAIL: "
));
append_with_tabs
(
&
buf
,
edata
->
detail_log
);
appendStringInfoChar
(
&
buf
,
'\n'
);
}
else
if
(
edata
->
detail
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfoString
(
&
buf
,
_
(
"DETAIL: "
));
append_with_tabs
(
&
buf
,
edata
->
detail
);
appendStringInfoChar
(
&
buf
,
'\n'
);
}
if
(
edata
->
hint
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfoString
(
&
buf
,
_
(
"HINT: "
));
append_with_tabs
(
&
buf
,
edata
->
hint
);
appendStringInfoChar
(
&
buf
,
'\n'
);
}
if
(
edata
->
internalquery
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfoString
(
&
buf
,
_
(
"QUERY: "
));
append_with_tabs
(
&
buf
,
edata
->
internalquery
);
appendStringInfoChar
(
&
buf
,
'\n'
);
}
if
(
edata
->
context
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfoString
(
&
buf
,
_
(
"CONTEXT: "
));
append_with_tabs
(
&
buf
,
edata
->
context
);
appendStringInfoChar
(
&
buf
,
'\n'
);
...
...
@@ -2132,14 +2135,14 @@ send_message_to_server_log(ErrorData *edata)
/* assume no newlines in funcname or filename... */
if
(
edata
->
funcname
&&
edata
->
filename
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfo
(
&
buf
,
_
(
"LOCATION: %s, %s:%d
\n
"
),
edata
->
funcname
,
edata
->
filename
,
edata
->
lineno
);
}
else
if
(
edata
->
filename
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfo
(
&
buf
,
_
(
"LOCATION: %s:%d
\n
"
),
edata
->
filename
,
edata
->
lineno
);
}
...
...
@@ -2153,7 +2156,7 @@ send_message_to_server_log(ErrorData *edata)
debug_query_string
!=
NULL
&&
!
edata
->
hide_stmt
)
{
log_line_prefix
(
&
buf
);
log_line_prefix
(
&
buf
,
edata
);
appendStringInfoString
(
&
buf
,
_
(
"STATEMENT: "
));
append_with_tabs
(
&
buf
,
debug_query_string
);
appendStringInfoChar
(
&
buf
,
'\n'
);
...
...
src/backend/utils/misc/postgresql.conf.sample
View file @
f39df967
...
...
@@ -337,6 +337,7 @@
# %t = timestamp without milliseconds
# %m = timestamp with milliseconds
# %i = command tag
# %e = SQL state
# %c = session ID
# %l = session line number
# %s = session start timestamp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment