From: | Tianyin Xu <tixu(at)cs(dot)ucsd(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | How to print application_name in log_line_prefix (using %a)? |
Date: | 2012-10-29 05:18:34 |
Message-ID: | CABBDWweOGkTVKjLtW-RUqY2NeJQuxK+JV7kVJkcNYE3ND7xitw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, guys,
Could anyone tell me how to specify the application_name as the
log_line_prefix?
According to the manual at
http://www.postgresql.org/docs/9.2/static/runtime-config-logging.html#GUC-APPLICATION-NAME
:
"
application_name (string)
The application_name can be any string of less than NAMEDATALEN characters
(64 characters in a standard build). It is typically set by an application
upon connection to the server. The name will be displayed in the
pg_stat_activity view and included in CSV log entries. It can also be
included in regular log entries via the
log_line_prefix<http://www.postgresql.org/docs/9.2/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX>parameter.
Only printable ASCII characters may be used in the
application_name value...
"
and also, the manual entry for log_line_prefix (
http://www.postgresql.org/docs/9.2/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
)
"
log_line_prefix (string)
This is a printf-style string that is output at the beginning of each log
line. % characters begin "escape sequences" that are replaced with status
information as outlined below...
%a Application name
"
However, I have the following configuration settings in postgresql.conf
application_name = 'mypostgres'
log_line_prefix = '[%a] '
But, my log line is prefixed as "[] " like
[] LOG: 00000: database system was shut down at 2012-10-28 22:15:08 PDT
[] LOCATION: StartupXLOG, xlog.c:6112
[] LOG: 00000: autovacuum launcher started
[] LOCATION: AutoVacLauncherMain, autovacuum.c:407
[] LOG: 00000: database system is ready to accept connections
[] LOCATION: reaper, postmaster.c:2408
Did I miss something?
Thanks a lot!
Tianyin
--
Tianyin XU,
http://cseweb.ucsd.edu/~tixu/
From | Date | Subject | |
---|---|---|---|
Next Message | Tianyin Xu | 2012-10-29 05:24:02 | How to print application_name in log_line_prefix (using %a)? |
Previous Message | 高健 | 2012-10-29 03:06:16 | SPI_prepare's parameter |