
I ended up doing more or less what Bruce suggested, for 2 reasons - 
first it is extensible, and second it avoids hardcoding any special 
separators.

The new config variable is set like this:

    log_line_format = '<%U%%%D> '     # %U=username %D=databasename %%=%

Sample output including session logging when log_connections= true:

2003-08-09 14:33:22 [14219] LOG:  database system was shut down at 
2003-08-09 14:33:17 EDT
2003-08-09 14:33:22 [14219] LOG:  checkpoint record is at 0/27A3470
2003-08-09 14:33:22 [14219] LOG:  redo record is at 0/27A3470; undo 
record is at 0/0; shutdown TRUE
2003-08-09 14:33:22 [14219] LOG:  next transaction id: 6235; next oid: 
154553
2003-08-09 14:33:22 [14219] LOG:  database system is ready
2003-08-09 14:33:35 [14222] LOG:  connection received: host=localhost port=
2003-08-09 14:33:35 [14222] <andrew%adtest> LOG:  connection authorized: 
user=andrew database=adtest
2003-08-09 14:33:53 [14222] <andrew%adtest> LOG:  query: create table 
foo (x text, y text);
2003-08-09 14:34:07 [14222] <andrew%adtest> LOG:  session ended: 
duration: 0:00:32.807689 user=andrew database=adtest
2003-08-09 14:34:22 [14217] LOG:  received fast shutdown request
2003-08-09 14:34:22 [14225] LOG:  shutting down
2003-08-09 14:34:25 [14225] LOG:  database system is shut down


I'll clean this up (don't think we really need microsec granularity on 
session logging) and submit the patch this weekend.

cheers

andrew



Sat, 09 Aug 2003 14:45:23 -0400
Andrew Dunstan <andrew@dunslane.net>
logging changes - sample output