HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Raise NOTICE, Raise INFO not saved to logs in POSTGRES

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
infologspostgresnoticeraisesavednot

Problem

I searched a lot on google but no solution found, I am not sure what I am missing here.

My intention here is to store the notice , info from this procedure to postgres logs (txt files) that are stored in the log directory.

in postgres, I wrote a simple procedure as below.
--- procedure ------

create or replace procedure log_debug_info()
language 'plpgsql'
as $body$
begin
raise notice 'Test notice';
raise info 'Test info';
raise log 'test log';
raise debug 'test debug';
end;
$body$


---end------
here is my configuration on logs.

```
#------------------------------------------------------------------------------
# REPORTING AND LOGGING
#------------------------------------------------------------------------------

# - Where to Log -

log_destination = 'stderr' # Valid values are combinations of
# stderr, csvlog, syslog, and eventlog,
# depending on platform. csvlog
# requires logging_collector to be on.

# This is used when logging to stderr:
logging_collector = on # Enable capturing of stderr and csvlog
# into log files. Required to be on for
# csvlogs.
# (change requires restart)

# These are only used if logging_collector is on:
#log_directory = 'log' # directory where log files are written,
# can be absolute or relative to PGDATA
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
# can include strftime() escapes
log_file_mode = 0640 # creation mode for log files,
# begin with 0 to use octal notation
#log_truncate_on_rotation = off # If on, an existing log file with the
# same name as the new log file will be
# truncated rather than appended to.
# But such truncation only occurs on
# time-driven rotation, not on restarts

Solution

#log_min_messages = debug5      # values in order of decreasing detail:


You have attempted to change this value from the default, but you have not removed the comment marker (the first '#'), so your attempted change has had no effect.

Code Snippets

#log_min_messages = debug5      # values in order of decreasing detail:

Context

StackExchange Database Administrators Q#255272, answer score: 5

Revisions (0)

No revisions yet.