main log encoding problem

Started by yi huangalmost 14 years ago2 messagesgeneral
Jump to latest
#1yi huang
yi.codeplayer@gmail.com

I'm using postgresql 9.1.3 from debian squeeze-backports with zh_CN.UTF-8
locale, i find my main log (which is
"/var/log/postgresql/postgresql-9.1-main.log") contains "???" which
indicate some sort of charset encoding problem.
But error messages related to pgsql is fine, only other system messages
have this problem, for example:

2012-05-19 16:06:12 CST ??: ?????????? 2012-05-19 16:06:10 CST

2012-05-19 16:06:12 CST ??: ???????????
2012-05-19 16:06:12 CST ??: ???autovacuum
2012-05-19 16:06:12 CST ??: ???????
2012-05-19 16:07:16 CST 错误: 角色"postgres" 已经存在 (in english: Error: role
"postgres" already exists)
2012-05-19 16:07:16 CST 语句: CREATE ROLE postgres;
2012-05-19 16:07:16 CST 错误: 语言 "plpgsql" 已经存在 (in
english: Error: language "plpgsql" already exists)
2012-05-19 16:07:16 CST 语句: CREATE PROCEDURAL LANGUAGE plpgsql;
2012-05-19 16:08:23 CST ????: ?? "huangyi" ???
2012-05-19 16:08:52 CST ????: ?? "huangyi" ???
2012-05-19 16:09:01 CST ??: ???????(zlfund)????????(huangyi) ???
2012-05-19 16:09:01 CST ????: Peer authentication failed for user "zlfund"
2012-05-19 16:09:34 CST ??: ???????(zlfund)????????(huangyi) ???
2012-05-19 16:09:34 CST ????: Peer authentication failed for user "zlfund"

I guess it has something to do with packaging problem rather than
postgresql itself, but it would be great if you can give me some clue where
the problem might be.

My best regards.
Yi Huang.

#2Craig Ringer
craig@2ndquadrant.com
In reply to: yi huang (#1)
Re: main log encoding problem

On 05/23/2012 09:15 AM, yi huang wrote:

I'm using postgresql 9.1.3 from debian squeeze-backports with
zh_CN.UTF-8 locale, i find my main log (which is
"/var/log/postgresql/postgresql-9.1-main.log") contains "???" which
indicate some sort of charset encoding problem.

It's a known issue, I'm afraid. The PostgreSQL postmaster logs in the
system locale, and the PostgreSQL backends log in whatever encoding
their database is in. They all write to the same log file, producing a
log file full of mixed encoding data that'll choke many text editors.

If you force your editor to re-interpret the file according to the
encoding your database(s) are in, this may help.

In the future it's possible that this may be fixed by logging output to
different files on a per-database basis or by converting the text
encoding of log messages, but no agreement has been reached on the
correct approach and nobody has stepped up to implement it.

--
Craig Ringer