MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/share/doc/postgresql-8.1.9/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/doc/postgresql-8.1.9/html/runtime-config-logging.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Error Reporting and Logging</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 8.1.9 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Server Configuration"
HREF="runtime-config.html"><LINK
REL="PREVIOUS"
TITLE="Query Planning"
HREF="runtime-config-query.html"><LINK
REL="NEXT"
TITLE="Run-Time Statistics"
HREF="runtime-config-statistics.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2007-04-20T04:40:08"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
>PostgreSQL 8.1.9 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="runtime-config-query.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="runtime-config.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
>Chapter 17. Server Configuration</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="runtime-config.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="runtime-config-statistics.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="RUNTIME-CONFIG-LOGGING"
>17.7. Error Reporting and Logging</A
></H1
><A
NAME="AEN19478"
></A
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="RUNTIME-CONFIG-LOGGING-WHERE"
>17.7.1. Where To Log</A
></H2
><A
NAME="AEN19482"
></A
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><A
NAME="GUC-LOG-DESTINATION"
></A
><TT
CLASS="VARNAME"
>log_destination</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> supports several methods
         for logging server messages, including
         <SPAN
CLASS="SYSTEMITEM"
>stderr</SPAN
> and
         <SPAN
CLASS="SYSTEMITEM"
>syslog</SPAN
>. On Windows, 
         <SPAN
CLASS="SYSTEMITEM"
>eventlog</SPAN
> is also supported. Set this
         option to a list of desired log destinations separated by
         commas. The default is to log to <SPAN
CLASS="SYSTEMITEM"
>stderr</SPAN
> 
         only.
         This option can be set at server start or in the
         <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-REDIRECT-STDERR"
></A
><TT
CLASS="VARNAME"
>redirect_stderr</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>         This option allows messages sent to <SPAN
CLASS="APPLICATION"
>stderr</SPAN
> to be
         captured and redirected into log files.
         This option, in combination with logging to <SPAN
CLASS="APPLICATION"
>stderr</SPAN
>,
         is often more useful than
         logging to <SPAN
CLASS="APPLICATION"
>syslog</SPAN
>, since some types of messages
         may not appear in <SPAN
CLASS="APPLICATION"
>syslog</SPAN
> output (a common example
         is dynamic-linker failure messages).
         This option can only be set at server start.
       </P
></DD
><DT
><A
NAME="GUC-LOG-DIRECTORY"
></A
><TT
CLASS="VARNAME"
>log_directory</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        When <TT
CLASS="VARNAME"
>redirect_stderr</TT
> is enabled, this option
        determines the directory in which log files will be created.
        It may be specified as an absolute path, or relative to the
        cluster data directory.
        This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-LOG-FILENAME"
></A
><TT
CLASS="VARNAME"
>log_filename</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        When <TT
CLASS="VARNAME"
>redirect_stderr</TT
> is enabled, this option
        sets the file names of the created log files.  The value
        is treated as a <SPAN
CLASS="SYSTEMITEM"
>strftime</SPAN
> pattern,
        so <TT
CLASS="LITERAL"
>%</TT
>-escapes
        can be used to specify time-varying file names.
        If no <TT
CLASS="LITERAL"
>%</TT
>-escapes are present,
        <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> will
        append the epoch of the new log file's open time.  For example,
        if <TT
CLASS="VARNAME"
>log_filename</TT
> were <TT
CLASS="LITERAL"
>server_log</TT
>, then the
        chosen file name would be <TT
CLASS="LITERAL"
>server_log.1093827753</TT
>
        for a log starting at Sun Aug 29 19:02:33 2004 MST.
        This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-LOG-ROTATION-AGE"
></A
><TT
CLASS="VARNAME"
>log_rotation_age</TT
> (<TT
CLASS="TYPE"
>integer</TT
>)</DT
><DD
><P
>        When <TT
CLASS="VARNAME"
>redirect_stderr</TT
> is enabled, this option
        determines the maximum lifetime of an individual log file.
        After this many minutes have elapsed, a new log file will
        be created.  Set to zero to disable time-based creation of
        new log files.
        This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-LOG-ROTATION-SIZE"
></A
><TT
CLASS="VARNAME"
>log_rotation_size</TT
> (<TT
CLASS="TYPE"
>integer</TT
>)</DT
><DD
><P
>        When <TT
CLASS="VARNAME"
>redirect_stderr</TT
> is enabled, this option
        determines the maximum size of an individual log file.
        After this many kilobytes have been emitted into a log file,
        a new log file will be created.  Set to zero to disable size-based
        creation of new log files.
        This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-LOG-TRUNCATE-ON-ROTATION"
></A
><TT
CLASS="VARNAME"
>log_truncate_on_rotation</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        When <TT
CLASS="VARNAME"
>redirect_stderr</TT
> is enabled, this option will cause
        <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> to truncate (overwrite),
        rather than append to, any existing log file of the same name.
        However, truncation will occur only when a new file is being opened
        due to time-based rotation, not during server startup or size-based
        rotation.  When off, pre-existing files will be appended to in
        all cases.  For example, using this option in combination with
        a <TT
CLASS="VARNAME"
>log_filename</TT
> like <TT
CLASS="LITERAL"
>postgresql-%H.log</TT
>
        would result in generating twenty-four hourly log files and then
        cyclically overwriting them.
        This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
><P
>        Example:  To keep 7 days of logs, one log file per day named
        <TT
CLASS="LITERAL"
>server_log.Mon</TT
>, <TT
CLASS="LITERAL"
>server_log.Tue</TT
>, 
        etc, and automatically overwrite last week's log with this week's log,
        set <TT
CLASS="VARNAME"
>log_filename</TT
> to <TT
CLASS="LITERAL"
>server_log.%a</TT
>, 
        <TT
CLASS="VARNAME"
>log_truncate_on_rotation</TT
> to <TT
CLASS="LITERAL"
>on</TT
>, and 
        <TT
CLASS="VARNAME"
>log_rotation_age</TT
> to <TT
CLASS="LITERAL"
>1440</TT
>.
       </P
><P
>        Example: To keep 24 hours of logs, one log file per hour, but 
        also rotate sooner if the log file size exceeds 1GB, set 
        <TT
CLASS="VARNAME"
>log_filename</TT
> to <TT
CLASS="LITERAL"
>server_log.%H%M</TT
>, 
        <TT
CLASS="VARNAME"
>log_truncate_on_rotation</TT
> to <TT
CLASS="LITERAL"
>on</TT
>, 
        <TT
CLASS="VARNAME"
>log_rotation_age</TT
> to <TT
CLASS="LITERAL"
>60</TT
>, and 
        <TT
CLASS="VARNAME"
>log_rotation_size</TT
> to <TT
CLASS="LITERAL"
>1000000</TT
>.
        Including <TT
CLASS="LITERAL"
>%M</TT
> in <TT
CLASS="VARNAME"
>log_filename</TT
> allows
        any size-driven rotations that may occur to select a file name
        different from the hour's initial file name.
       </P
></DD
><DT
><A
NAME="GUC-SYSLOG-FACILITY"
></A
><TT
CLASS="VARNAME"
>syslog_facility</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        When logging to <SPAN
CLASS="APPLICATION"
>syslog</SPAN
> is enabled, this option
        determines the <SPAN
CLASS="APPLICATION"
>syslog</SPAN
>
        <SPAN
CLASS="QUOTE"
>"facility"</SPAN
> to be used.  You may choose
        from <TT
CLASS="LITERAL"
>LOCAL0</TT
>, <TT
CLASS="LITERAL"
>LOCAL1</TT
>,
        <TT
CLASS="LITERAL"
>LOCAL2</TT
>, <TT
CLASS="LITERAL"
>LOCAL3</TT
>, <TT
CLASS="LITERAL"
>LOCAL4</TT
>,
        <TT
CLASS="LITERAL"
>LOCAL5</TT
>, <TT
CLASS="LITERAL"
>LOCAL6</TT
>, <TT
CLASS="LITERAL"
>LOCAL7</TT
>;
        the default is <TT
CLASS="LITERAL"
>LOCAL0</TT
>. See also the
        documentation of your system's
        <SPAN
CLASS="APPLICATION"
>syslog</SPAN
> daemon.
        This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-SYSLOG-IDENT"
></A
><TT
CLASS="VARNAME"
>syslog_ident</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>         When logging to <SPAN
CLASS="APPLICATION"
>syslog</SPAN
> is enabled, this option
         determines the program name used to identify
         <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> messages in
         <SPAN
CLASS="APPLICATION"
>syslog</SPAN
> logs. The default is
         <TT
CLASS="LITERAL"
>postgres</TT
>.
         This option can be set at server start or in the
         <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
        </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="RUNTIME-CONFIG-LOGGING-WHEN"
>17.7.2. When To Log</A
></H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><A
NAME="GUC-CLIENT-MIN-MESSAGES"
></A
><TT
CLASS="VARNAME"
>client_min_messages</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        Controls which message levels are sent to the client.
        Valid values are <TT
CLASS="LITERAL"
>DEBUG5</TT
>,
        <TT
CLASS="LITERAL"
>DEBUG4</TT
>, <TT
CLASS="LITERAL"
>DEBUG3</TT
>, <TT
CLASS="LITERAL"
>DEBUG2</TT
>,
        <TT
CLASS="LITERAL"
>DEBUG1</TT
>, <TT
CLASS="LITERAL"
>LOG</TT
>, <TT
CLASS="LITERAL"
>NOTICE</TT
>,
        <TT
CLASS="LITERAL"
>WARNING</TT
>, <TT
CLASS="LITERAL"
>ERROR</TT
>, <TT
CLASS="LITERAL"
>FATAL</TT
>,
        and <TT
CLASS="LITERAL"
>PANIC</TT
>.  Each level
        includes all the levels that follow it.  The later the level,
        the fewer messages are sent.  The default is
        <TT
CLASS="LITERAL"
>NOTICE</TT
>.  Note that <TT
CLASS="LITERAL"
>LOG</TT
> has a different
        rank here than in <TT
CLASS="VARNAME"
>log_min_messages</TT
>.
       </P
></DD
><DT
><A
NAME="GUC-LOG-MIN-MESSAGES"
></A
><TT
CLASS="VARNAME"
>log_min_messages</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        Controls which message levels are written to the server log.
        Valid values are <TT
CLASS="LITERAL"
>DEBUG5</TT
>, <TT
CLASS="LITERAL"
>DEBUG4</TT
>,
        <TT
CLASS="LITERAL"
>DEBUG3</TT
>, <TT
CLASS="LITERAL"
>DEBUG2</TT
>, <TT
CLASS="LITERAL"
>DEBUG1</TT
>,
        <TT
CLASS="LITERAL"
>INFO</TT
>, <TT
CLASS="LITERAL"
>NOTICE</TT
>, <TT
CLASS="LITERAL"
>WARNING</TT
>,
        <TT
CLASS="LITERAL"
>ERROR</TT
>, <TT
CLASS="LITERAL"
>LOG</TT
>, <TT
CLASS="LITERAL"
>FATAL</TT
>, and
        <TT
CLASS="LITERAL"
>PANIC</TT
>.  Each level includes all the levels that
        follow it.  The later the level, the fewer messages are sent
        to the log.  The default is <TT
CLASS="LITERAL"
>NOTICE</TT
>.  Note that
        <TT
CLASS="LITERAL"
>LOG</TT
> has a different rank here than in
        <TT
CLASS="VARNAME"
>client_min_messages</TT
>.
        Only superusers can change this setting.
       </P
></DD
><DT
><A
NAME="GUC-LOG-ERROR-VERBOSITY"
></A
><TT
CLASS="VARNAME"
>log_error_verbosity</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        Controls the amount of detail written in the server log for each
        message that is logged.  Valid values are <TT
CLASS="LITERAL"
>TERSE</TT
>,
        <TT
CLASS="LITERAL"
>DEFAULT</TT
>, and <TT
CLASS="LITERAL"
>VERBOSE</TT
>, each adding more
        fields to displayed messages.
        Only superusers can change this setting.
       </P
></DD
><DT
><A
NAME="GUC-LOG-MIN-ERROR-STATEMENT"
></A
><TT
CLASS="VARNAME"
>log_min_error_statement</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        Controls whether or not the SQL statement that causes an error
        condition will also be recorded in the server log. All SQL
        statements that cause an error of the specified level or
        higher are logged.  The default is
        <TT
CLASS="LITERAL"
>PANIC</TT
> (effectively turning this feature
        off for normal use). Valid values are <TT
CLASS="LITERAL"
>DEBUG5</TT
>,
        <TT
CLASS="LITERAL"
>DEBUG4</TT
>, <TT
CLASS="LITERAL"
>DEBUG3</TT
>,
        <TT
CLASS="LITERAL"
>DEBUG2</TT
>, <TT
CLASS="LITERAL"
>DEBUG1</TT
>,
        <TT
CLASS="LITERAL"
>INFO</TT
>, <TT
CLASS="LITERAL"
>NOTICE</TT
>,
        <TT
CLASS="LITERAL"
>WARNING</TT
>, <TT
CLASS="LITERAL"
>ERROR</TT
>,
        <TT
CLASS="LITERAL"
>FATAL</TT
>, and <TT
CLASS="LITERAL"
>PANIC</TT
>.  For
        example, if you set this to <TT
CLASS="LITERAL"
>ERROR</TT
> then all
        SQL statements causing errors, fatal errors, or panics will be
        logged. Enabling this option can be helpful in tracking down
        the source of any errors that appear in the server log.
        Only superusers can change this setting.
       </P
></DD
><DT
><A
NAME="GUC-LOG-MIN-DURATION-STATEMENT"
></A
><TT
CLASS="VARNAME"
>log_min_duration_statement</TT
> (<TT
CLASS="TYPE"
>integer</TT
>)</DT
><DD
><P
>         Logs the statement and its duration on a single log line if its
         duration is greater than or equal to the specified number of
         milliseconds. Setting this to zero will print all statements
         and their durations. Minus-one (the default) disables the
         feature. For example, if you set it to <TT
CLASS="LITERAL"
>250</TT
>
         then all SQL statements that run 250ms or longer will be
         logged. Enabling this option can be useful in tracking down
         unoptimized queries in your applications. This setting is
         independent of <TT
CLASS="VARNAME"
>log_statement</TT
> and
         <TT
CLASS="VARNAME"
>log_duration</TT
>. Only superusers can change
         this setting.
        </P
></DD
><DT
><A
NAME="GUC-SILENT-MODE"
></A
><TT
CLASS="VARNAME"
>silent_mode</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        Runs the server silently. If this option is set, the server
        will automatically run in background and any controlling
        terminals are disassociated (same effect as
        <TT
CLASS="COMMAND"
>postmaster</TT
>'s <TT
CLASS="OPTION"
>-S</TT
> option).
        The server's standard output and standard error are redirected
        to <TT
CLASS="LITERAL"
>/dev/null</TT
>, so any messages sent to them will be lost.
        Unless <SPAN
CLASS="APPLICATION"
>syslog</SPAN
> logging is selected or
        <TT
CLASS="VARNAME"
>redirect_stderr</TT
> is enabled, using this option
        is discouraged because it makes it impossible to see error messages.
       </P
></DD
></DL
></DIV
><P
>        Here is a list of the various message severity levels used in
        these settings:
        <P
></P
></P><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>DEBUG[1-5]</TT
></DT
><DD
><P
>            Provides information for use by developers.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>INFO</TT
></DT
><DD
><P
>            Provides information implicitly requested by the user,
            e.g., during <TT
CLASS="COMMAND"
>VACUUM VERBOSE</TT
>.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>NOTICE</TT
></DT
><DD
><P
>            Provides information that may be helpful to users, e.g.,
            truncation of long identifiers and the creation of indexes as part
            of primary keys.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>WARNING</TT
></DT
><DD
><P
>            Provides warnings to the user, e.g., <TT
CLASS="COMMAND"
>COMMIT</TT
>
            outside a transaction block.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>ERROR</TT
></DT
><DD
><P
>            Reports an error that caused the current command to abort.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>LOG</TT
></DT
><DD
><P
>            Reports information of interest to administrators, e.g.,
            checkpoint activity.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>FATAL</TT
></DT
><DD
><P
>            Reports an error that caused the current session to abort.
           </P
></DD
><DT
><TT
CLASS="LITERAL"
>PANIC</TT
></DT
><DD
><P
>            Reports an error that caused all sessions to abort.
           </P
></DD
></DL
></DIV
><P>
       </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="RUNTIME-CONFIG-LOGGING-WHAT"
>17.7.3. What To Log</A
></H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="VARNAME"
>debug_print_parse</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)<BR><TT
CLASS="VARNAME"
>debug_print_rewritten</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)<BR><TT
CLASS="VARNAME"
>debug_print_plan</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)<BR><TT
CLASS="VARNAME"
>debug_pretty_print</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        These options enable various debugging output to be emitted.
        For each executed query, they print
        the resulting parse tree, the query rewriter output, or the
        execution plan.  <TT
CLASS="VARNAME"
>debug_pretty_print</TT
> indents
        these displays to produce a more readable but much longer
        output format.  <TT
CLASS="VARNAME"
>client_min_messages</TT
> or
        <TT
CLASS="VARNAME"
>log_min_messages</TT
> must be
        <TT
CLASS="LITERAL"
>DEBUG1</TT
> or lower to actually send this output
        to the client or the server log, respectively.
        These options are off by default.
       </P
></DD
><DT
><A
NAME="GUC-LOG-CONNECTIONS"
></A
><TT
CLASS="VARNAME"
>log_connections</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        This outputs a line to the server log detailing each successful
        connection. This is off by default, although it is probably very
        useful.  Some client programs, like <SPAN
CLASS="APPLICATION"
>psql</SPAN
>, attempt 
        to connect twice while determining if a password is required, so 
        duplicate <SPAN
CLASS="QUOTE"
>"connection received"</SPAN
> messages do not
        necessarily indicate a problem. This option can only be set at
        server start or in the <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-LOG-DISCONNECTIONS"
></A
><TT
CLASS="VARNAME"
>log_disconnections</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        This outputs a line in the server log similar to
        <TT
CLASS="VARNAME"
>log_connections</TT
> but at session termination,
        and includes the duration of the session.  This is off by
        default. This option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.
       </P
></DD
><DT
><A
NAME="GUC-LOG-DURATION"
></A
><TT
CLASS="VARNAME"
>log_duration</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        Causes the duration of every completed statement which satisfies
        <TT
CLASS="VARNAME"
>log_statement</TT
> to be logged.  When using this option, 
        if you are not using <SPAN
CLASS="APPLICATION"
>syslog</SPAN
>, it is recommended 
        that you log the PID or session ID using <TT
CLASS="VARNAME"
>log_line_prefix</TT
> 
        so that you can link the statement message to the later
        duration message using the process ID or session ID. The default is
        <TT
CLASS="LITERAL"
>off</TT
>. Only superusers can change this setting.
       </P
></DD
><DT
><A
NAME="GUC-LOG-LINE-PREFIX"
></A
><TT
CLASS="VARNAME"
>log_line_prefix</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>         This is a <CODE
CLASS="FUNCTION"
>printf</CODE
>-style string that is output at the
         beginning of each log line. The default is an empty string.
         Each recognized escape is replaced as outlined 
         below - anything else that looks like an escape is ignored. Other
         characters are copied straight to the log line. Some escapes are
         only recognized by session processes, and do not apply to
         background processes such as the postmaster. <SPAN
CLASS="APPLICATION"
>Syslog</SPAN
>
         produces its own 
         time stamp and process ID information, so you probably do not want to
         use those escapes if you are using <SPAN
CLASS="APPLICATION"
>syslog</SPAN
>.
         This option can be set at server start or in the
         <TT
CLASS="FILENAME"
>postgresql.conf</TT
> configuration file.

         <DIV
CLASS="INFORMALTABLE"
><P
></P
><A
NAME="AEN19872"
></A
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Escape</TH
><TH
>Effect</TH
><TH
>Session only</TH
></TR
></THEAD
><TBODY
><TR
><TD
><TT
CLASS="LITERAL"
>%u</TT
></TD
><TD
>User name</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%d</TT
></TD
><TD
>Database name</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%r</TT
></TD
><TD
>Remote host name or IP address, and remote port</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%h</TT
></TD
><TD
>Remote host name or IP address</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%p</TT
></TD
><TD
>Process ID</TD
><TD
>no</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%t</TT
></TD
><TD
>Time stamp (no milliseconds)</TD
><TD
>no</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%m</TT
></TD
><TD
>Time stamp with milliseconds</TD
><TD
>no</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%i</TT
></TD
><TD
>Command tag: This is the command that generated the log line.</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%c</TT
></TD
><TD
>Session ID: A unique identifier for each session.
             It is 2 4-byte hexadecimal numbers (without leading zeros) 
             separated by a dot. The numbers
             are the session start time and the process ID, so this can also
             be used as a space saving way of printing these items.</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%l</TT
></TD
><TD
>Number of the log line for each process, starting at 1</TD
><TD
>no</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%s</TT
></TD
><TD
>Session start time stamp</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%x</TT
></TD
><TD
>Transaction ID</TD
><TD
>yes</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%q</TT
></TD
><TD
>Does not produce any output, but tells non-session
             processes to stop at this point in the string. Ignored by
             session processes.</TD
><TD
>no</TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>%%</TT
></TD
><TD
>Literal <TT
CLASS="LITERAL"
>%</TT
></TD
><TD
>no</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
>
       </P
></DD
><DT
><A
NAME="GUC-LOG-STATEMENT"
></A
><TT
CLASS="VARNAME"
>log_statement</TT
> (<TT
CLASS="TYPE"
>string</TT
>)</DT
><DD
><P
>        Controls which SQL statements are logged. Valid values are
        <TT
CLASS="LITERAL"
>none</TT
>, <TT
CLASS="LITERAL"
>ddl</TT
>, <TT
CLASS="LITERAL"
>mod</TT
>, and
        <TT
CLASS="LITERAL"
>all</TT
>. <TT
CLASS="LITERAL"
>ddl</TT
> logs all data definition
        commands like <TT
CLASS="LITERAL"
>CREATE</TT
>, <TT
CLASS="LITERAL"
>ALTER</TT
>, and
        <TT
CLASS="LITERAL"
>DROP</TT
> commands. <TT
CLASS="LITERAL"
>mod</TT
> logs all
        <TT
CLASS="LITERAL"
>ddl</TT
> statements, plus <TT
CLASS="LITERAL"
>INSERT</TT
>,
        <TT
CLASS="LITERAL"
>UPDATE</TT
>, <TT
CLASS="LITERAL"
>DELETE</TT
>, <TT
CLASS="LITERAL"
>TRUNCATE</TT
>,
        and <TT
CLASS="LITERAL"
>COPY FROM</TT
>. <TT
CLASS="LITERAL"
>PREPARE</TT
> and
        <TT
CLASS="LITERAL"
>EXPLAIN ANALYZE</TT
> statements are also logged if their
        contained command is of an appropriate type.
       </P
><P
>        The default is <TT
CLASS="LITERAL"
>none</TT
>. Only superusers can change this
        setting.
       </P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>         The <TT
CLASS="COMMAND"
>EXECUTE</TT
> statement is not considered a
         <TT
CLASS="LITERAL"
>ddl</TT
> or <TT
CLASS="LITERAL"
>mod</TT
> statement.  Statements that
         generate syntax errors are not logged.  Set
         <TT
CLASS="VARNAME"
>log_min_error_statement</TT
> to <TT
CLASS="LITERAL"
>error</TT
> to
         log such statements.      
        </P
><P
>         When a function is defined in the
         <SPAN
CLASS="APPLICATION"
>PL/pgSQL</SPAN
>server-side language, any queries
         executed by the function will only be logged the first time that the
         function is invoked in a particular session. This is because
         <SPAN
CLASS="APPLICATION"
>PL/pgSQL</SPAN
> keeps a cache of the
         query plans produced for the SQL statements in the function.
        </P
></BLOCKQUOTE
></DIV
></DD
><DT
><A
NAME="GUC-LOG-HOSTNAME"
></A
><TT
CLASS="VARNAME"
>log_hostname</TT
> (<TT
CLASS="TYPE"
>boolean</TT
>)</DT
><DD
><P
>        By default, connection log messages only show the IP address of the
        connecting host. Turning on this option causes logging of the
        host name as well.  Note that depending on your host name resolution
        setup this might impose a non-negligible performance penalty. This
        option can be set at server start or in the
        <TT
CLASS="FILENAME"
>postgresql.conf</TT
> file.
       </P
></DD
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="runtime-config-query.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="runtime-config-statistics.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Query Planning</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="runtime-config.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Run-Time Statistics</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

Anon7 - 2021