logs encoding problem Windows

Lists: pgsql-general
From: Bartosz Dmytrak <bdmytrak(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: logs encoding problem Windows
Date: 2012-12-07 09:28:15
Message-ID: CAD8_UcbfncTLTPeVcihXGJtGoB5BjfqBH48R3Zor0Y91Ph0hUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi All
I've got a question about logs encoding on Windows.
To be honest, I've tried read logs via pgAdmin what gave me an error, then
tried with other tools.

At the end of the day I tried with postgresql itself:
SELECT
convert_from(pg_read_binary_file('pg_log/postgresql-2012-12-07_000000.log',
0, 2000), 'UTF8');

gives error:
ERROR: invalid byte sequence for encoding "UTF8": 0xb3

then
SELECT
convert_from(pg_read_binary_file('pg_log/postgresql-2012-12-07_000000.log',
0, 2000), 'WIN1250');

gives interesting output:
2012-12-07 00:00:01.869 CET|[nieznany]||[nieznany]|[nieznany]|8704
DZIENNIK: odebrano połączenie: host=myhost.mydomain.pl port=57135
2012-12-07 00:00:01.918 CET|[nieznany]|myhost.mydomain.pl|pgAgent|postgres|8704
DZIENNIK: zautoryzowano połączenie: użytkownik=pgAgent baza danych=postgres
2012-12-07 00:00:01.923 CET|[nieznany]|myhost.mydomain.pl|pgAgent|postgres|8704
DZIENNIK: wyraĹĽenie: UPDATE pgagent.pga_job SET jobagentid=2556,
joblastrun=now() WHERE jobagentid IS NULL AND jobid=19

it looks like some polish diacritical letters are wrong. To give an example:
u*ż*ytkownik and wyra*ĹĽ*enie (should be "wyrażenie") contain the
same character "ż", but it is encoded differently. Is it a internal bug in
different setting of encoding in different postgres elements?

env:
Postgres 9.2.1 64 bit on Windows Server 2008R2
client on: Windows 7 32bit

postgresql.conf settings:
log_line_prefix: %m|%a|%h|%u|%d|%p
log_statement: all

Regards,
Bartek


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bartosz Dmytrak <bdmytrak(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: logs encoding problem Windows
Date: 2012-12-07 15:16:06
Message-ID: 22715.1354893366@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Bartosz Dmytrak <bdmytrak(at)gmail(dot)com> writes:
> I've got a question about logs encoding on Windows.

Postmaster log messages are written in whatever the database_encoding
is, so if you've got multiple databases with different encodings, the
encoding in the log will be inconsistent. There have been debates about
fixing this but every solution has disadvantages. For the moment my
advice would be to use a single database encoding if inconsistent log
encoding is a problem for you.

regards, tom lane


From: Bartosz Dmytrak <bdmytrak(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: logs encoding problem Windows
Date: 2012-12-10 08:18:06
Message-ID: CAD8_Ucaik-AX92Gr0zi9AzPst58SCiKSShcsQBrVob+KpTkA+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

2012/12/7 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>
> Postmaster log messages are written in whatever the database_encoding
> is, so if you've got multiple databases with different encodings, the
> encoding in the log will be inconsistent.

Thanks for your answer Tom.
but...
all DBs are encoded in UTF8 (SELECT encoding FROM pg_database gives 6 for
all DBs).
Is that encoding You think about?

datcollate and datctype are Polish Poland.1250 for all DBs

Regards,
Bartek