The logfile mechanism should work, even if you connect multiple times with the same user.
This is not a generic problem (it's a potential bottleneck, which is why session logfiles exist,
but this is not something that fails with duplicate keys on a regular basis).
Using the SDE user for data and connections is very bad, and exposes the potential to
destroy the geodatabase casually, but this should not cause this error either.
I don't know that the error will go away, because I could never create the error in the
first place. I think there's a serious flaw in the PostgreSQL configuration, and that this
must be addressed while trying to resolve the logfile corruption.
Given the complications of running services as SDE, the best solution would be to implement
best practices (start from scratch in a new database, using multiple users, with tablespaces
to store user data, and using roles to manage non-owner data access), THEN review
logfile functionality.
- V