Thread: logs encoding problem Windows
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
Bartosz Dmytrak <bdmytrak@gmail.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
2012/12/7 Tom Lane <tgl@sss.pgh.pa.us>
Thanks for your answer Tom.
Regards,
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.
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