Skip site navigation (1) Skip section navigation (2)

Re: syslog output from explain looks weird...

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: syslog output from explain looks weird...
Date: 2000-11-25 04:37:59
Message-ID: 200011250438.XAA01181@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Applied.


> * Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [001122 22:44]:
> > Larry Rosenman <ler(at)lerctr(dot)org> writes:
> > > Looking some more, I found some other places that need a space (I
> > > suspect...), so here is an updated patch.
> > 
> > This seems like the wrong way to go about it, because anytime anyone
> > changes any elog output anywhere, we'll risk another failure.  If
> > syslog can't cope with empty lines, I think the right fix is for the
> > output-to-syslog routine to change the data just before sending ---
> > then there is only one place to fix.  See the syslog output routine in
> > src/backend/utils/error/elog.c.
> Makes sense.  Here's a new patch, now the output even looks better:
> Nov 23 00:58:04 lerami pg-test[9914]: [2-1] NOTICE:  QUERY PLAN:
> Nov 23 00:58:04 lerami pg-test[9914]: [2-2] 
> Nov 23 00:58:04 lerami pg-test[9914]: [2-3] Seq Scan on upsdata
> (cost=0.00..2766.62 rows=2308 width=48)
> Nov 23 00:58:04 lerami pg-test[9914]: [2-4] 
> 
> 
> Index: src/backend/utils/error/elog.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v
> retrieving revision 1.67
> diff -c -r1.67 elog.c
> *** src/backend/utils/error/elog.c	2000/11/14 19:13:27	1.67
> --- src/backend/utils/error/elog.c	2000/11/23 06:58:23
> ***************
> *** 657,663 ****
>   	seq++;
>   
>   	/* divide into multiple syslog() calls if message is too long */
> ! 	if (len > PG_SYSLOG_LIMIT)
>   	{
>   		static char	buf[PG_SYSLOG_LIMIT+1];
>   		int chunk_nr = 0;
> --- 657,664 ----
>   	seq++;
>   
>   	/* divide into multiple syslog() calls if message is too long */
> ! 	/* or if the message contains embedded NewLine(s) '\n' */
> ! 	if (len > PG_SYSLOG_LIMIT || strchr(line,'\n') != NULL )
>   	{
>   		static char	buf[PG_SYSLOG_LIMIT+1];
>   		int chunk_nr = 0;
> ***************
> *** 667,675 ****
> --- 668,684 ----
>   		{
>   			int l;
>   			int i;
> + 			/* if we start at a newline, move ahead one char */
> + 			if (line[0] == '\n')
> + 			{
> + 				line++;
> + 				len--;
> + 			}
>   
>   			strncpy(buf, line, PG_SYSLOG_LIMIT);
>   			buf[PG_SYSLOG_LIMIT] = '\0';
> + 			if (strchr(buf,'\n') != NULL) 
> + 				*strchr(buf,'\n') = '\0';
>   
>   			l = strlen(buf);
>   #ifdef MULTIBYTE
> -- 
> Larry Rosenman                      http://www.lerctr.org/~ler
> Phone: +1 972-414-9812 (voice) Internet: ler(at)lerctr(dot)org
> US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2000-11-25 04:38:09
Subject: Re: syslog output from explain looks weird...
Previous:From: Bruce MomjianDate: 2000-11-25 04:15:23
Subject: Re: location of Unix socket

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group