🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
9 messages
9 total messages Started by Anne Wilson Thu, 06 Dec 2001 01:08
INN: flushing trace statments
#55503
Author: Anne Wilson
Date: Thu, 06 Dec 2001 01:08
35 lines
2476 bytes
Hi,

Using an INN server, I'm writing my own routine to process news articles
as they arrive.  That is, I've got the following entry in newsfeeds:

test!:!*,unidata.hds\
	:Tc,Wn:\
	/opt/news/util/dataProdHandlers/articleDecoder "KLBB 20011205000609"

I would like to see my trace statements in articleDecoder appear as my
routine is executed, but it seems that syslog messages and print
statements (I've only tried printing to stderr) are being buffered.  At
least, sometimes syslog messages appears in "news.notice" and sometimes
they don't.  And sometimes printfs to stderr appear in "errlog" and
sometimes they don't.  And sometimes messages seem to appear later.  And
sometimes it seems that printf to stderr appears in "news".  I'm not at
all clear about what's going on.

How can I get messages to appear in some consistent place as my routine
is being executed?  I've tried flushing newsfeeds sites and also
flushing the logs.  The former hasn't helped, and the later only rotates
the logs.   Can anyone provide a tip?

Thank you!

Anne
-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: INN: flushing trace statments
#55505
Author: Jeffrey M. Vinocur
Date: Thu, 06 Dec 2001 01:58
29 lines
1893 bytes
In article <3C0EC505.81AF25D4@unidata.ucar.edu>,
Anne Wilson  <anne@unidata.ucar.edu> wrote:
>
> [ a channel feed program ]
>
>I would like to see my trace statements in articleDecoder appear as my
>routine is executed, but it seems that syslog messages and print
>statements (I've only tried printing to stderr) are being buffered.

Yeah...I've never been sufficiently annoyed with the lag to
news.notice to see if there's any way to do anything about it.


>How can I get messages to appear in some consistent place as my routine
>is being executed?

If that's all you want...you could just append to a file of your
own (e.g., articleDecoder.log).  (I think you only ever have one
copy of articleDecoder running at once, right?)

If this is for debugging, that's all you need.  If it's
long-term, we might want to think this through a little more
carefully.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: INN: flushing trace statments
#55507
Author: Andrew Gierth
Date: Thu, 06 Dec 2001 02:13
35 lines
2258 bytes
>>>>> "Anne" == Anne Wilson <anne@unidata.ucar.edu> writes:

 Anne> Hi,
 Anne> Using an INN server, I'm writing my own routine to process news
 Anne> articles as they arrive.  That is, I've got the following entry
 Anne> in newsfeeds:

 Anne> test!:!*,unidata.hds\
 Anne> 	:Tc,Wn:\
 Anne> 	/opt/news/util/dataProdHandlers/articleDecoder "KLBB 20011205000609"

 Anne> I would like to see my trace statements in articleDecoder
 Anne> appear as my routine is executed, but it seems that syslog
 Anne> messages and print statements (I've only tried printing to
 Anne> stderr) are being buffered.

What is "articleDecoder" written in?

syslog messages should never be buffered. Output to stderr should appear
in the errlog. In some cases it may be necessary to explicitly mark
stderr as unbuffered or line-buffered.

 Anne> And sometimes it seems that printf to stderr appears in "news".

I don't think that should be happening.

 Anne> How can I get messages to appear in some consistent place as my
 Anne> routine is being executed?

syslog is usually the most reliable. Alternatively you may want to
open your own log file.

-- 
Andrew.
Re: INN: flushing trace statments
#55516
Author: Anne Wilson
Date: Thu, 06 Dec 2001 18:40
51 lines
2807 bytes
"Jeffrey M. Vinocur" wrote:
> 
> In article <3C0EC505.81AF25D4@unidata.ucar.edu>,
> Anne Wilson  <anne@unidata.ucar.edu> wrote:
> >
> > [ a channel feed program ]
> >
> >I would like to see my trace statements in articleDecoder appear as my
> >routine is executed, but it seems that syslog messages and print
> >statements (I've only tried printing to stderr) are being buffered.
> 
> Yeah...I've never been sufficiently annoyed with the lag to
> news.notice to see if there's any way to do anything about it.
> 
> >How can I get messages to appear in some consistent place as my routine
> >is being executed?
> 
> If that's all you want...you could just append to a file of your
> own (e.g., articleDecoder.log).  (I think you only ever have one
> copy of articleDecoder running at once, right?)
> 

I only run one copy now, but will run multiple copies in the future. 
For now, since I've not been consistently successful with anything else,
I may write to my own file.

> If this is for debugging, that's all you need.  If it's
> long-term, we might want to think this through a little more
> carefully.
> 

Now it's only for debugging, but I suspect it will be important in the
future to have timely notification of any problems.

Thanks, Jeffrey!

Anne

> --
> Jeffrey M. Vinocur
> jeff@litech.org

-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: INN: flushing trace statments
#55517
Author: Anne Wilson
Date: Thu, 06 Dec 2001 18:50
66 lines
3198 bytes
Andrew Gierth wrote:
> 
> >>>>> "Anne" == Anne Wilson <anne@unidata.ucar.edu> writes:
> 
>  Anne> Hi,
>  Anne> Using an INN server, I'm writing my own routine to process news
>  Anne> articles as they arrive.  That is, I've got the following entry
>  Anne> in newsfeeds:
> 
>  Anne> test!:!*,unidata.hds\
>  Anne>  :Tc,Wn:\
>  Anne>  /opt/news/util/dataProdHandlers/articleDecoder "KLBB 20011205000609"
> 
>  Anne> I would like to see my trace statements in articleDecoder
>  Anne> appear as my routine is executed, but it seems that syslog
>  Anne> messages and print statements (I've only tried printing to
>  Anne> stderr) are being buffered.
> 
> What is "articleDecoder" written in?

It's written in C.

> 
> syslog messages should never be buffered. Output to stderr should appear
> in the errlog. In some cases it may be necessary to explicitly mark
> stderr as unbuffered or line-buffered.
> 

But, I'd swear the syslog messages are being buffered.  Or maybe
something else is wrong - the messages just stopped appearing  yesterday
around 5:00 - time to quit!  But syslogd has been running for some
time.  I don't know what else it could be.


>  Anne> And sometimes it seems that printf to stderr appears in "news".
> 
> I don't think that should be happening.
> 

Maybe I was dreaming...

>  Anne> How can I get messages to appear in some consistent place as my
>  Anne> routine is being executed?
> 
> syslog is usually the most reliable. Alternatively you may want to
> open your own log file.
> 

I'll open my own file, but I sure wish I understood what's going on with
syslog, and the stderr buffering.

> --
> Andrew.

Thank you, Andrew.

Anne
-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: INN: flushing trace statments
#55520
Author: Jeffrey M. Vinocur
Date: Thu, 06 Dec 2001 22:53
23 lines
1751 bytes
In article <3C0FBB96.CFDB8CEC@unidata.ucar.edu>,
Anne Wilson  <anne@unidata.ucar.edu> wrote:
> 
>I only run one copy now, but will run multiple copies in the future. 

But isn't it a channel feed?  That shouldn't be running multiple
copies, presumably.


>Now it's only for debugging, but I suspect it will be important in the
>future to have timely notification of any problems.

Well, if your code detects something going wrong, it can log to
news.crit at which point someone will likely get mail about it.
If you just want somebody to watch the logs, anything more than a
daily summary is unlikely (unless you've got a lot of
self-discipline).


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: INN: flushing trace statments
#55536
Author: Anne Wilson
Date: Fri, 07 Dec 2001 17:21
42 lines
2663 bytes
"Jeffrey M. Vinocur" wrote:
> 
> In article <3C0FBB96.CFDB8CEC@unidata.ucar.edu>,
> Anne Wilson  <anne@unidata.ucar.edu> wrote:
> >
> >I only run one copy now, but will run multiple copies in the future.
> 
> But isn't it a channel feed?  That shouldn't be running multiple
> copies, presumably.
> 

Yes, it is a channel feed.  But I expect that there will be different
newsfeeds sites invoking my decoder, and thus there will be multiple
copies.  I.e., newsfeeds might have entries like:

test1!:!*,unidata.hds\
	:Tc,Wn:\
	/opt/news/util/dataProdHandlers/articleDecoder <subDecoder1>

test2!:!*,unidata.ddplus\
	:Tc,Wn:\
	/opt/news/util/dataProdHandlers/articleDecoder <subDecoder2>

That is, articleDecoder may be invoked with any one of a number of other
decoders, which will decode the resulting data product according to its
particular format.

However, this reveals a hole in my understanding.  I coded my decoder to
read from stdin, process one article, then quit.  I presume I need to
modify this to continually read from stdin in order to avoid the
overhead of stopping and starting, right?

Anne
-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: INN: flushing trace statments
#55541
Author: Jeffrey M. Vinocur
Date: Fri, 07 Dec 2001 20:05
43 lines
2521 bytes
In article <3C10FA9A.875F2364@unidata.ucar.edu>,
Anne Wilson  <anne@unidata.ucar.edu> wrote:
>"Jeffrey M. Vinocur" wrote:
>> Anne Wilson  <anne@unidata.ucar.edu> wrote:
>>
>> >I only run one copy now, but will run multiple copies in the future.
>> 
>> But isn't it a channel feed?  That shouldn't be running multiple
>> copies, presumably.
>
>Yes, it is a channel feed.  But I expect that there will be different
>newsfeeds sites invoking my decoder, and thus there will be multiple
>copies.

Ah.

(Of course, if there are only a few, you could open a log file
for each based on the argument you're passing it.)


>However, this reveals a hole in my understanding.  I coded my decoder to
>read from stdin, process one article, then quit.  I presume I need to
>modify this to continually read from stdin in order to avoid the
>overhead of stopping and starting, right?

If you want to use a channel feed, it ought to be a long-running
process.  However, there's nothing immoral about using a program
feed -- if the overhead to starting your program is relatively
low, and you expect to get articles relatively infrequently, then
it's not a big deal.


For example, if you get an article to decode every ten minutes,
and decoding takes two minutes, and launching your program takes
ten seconds per use, you may not want to bother optimizing it for
long-running usage.



-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: INN: flushing trace statments
#55600
Author: those who know me have no need o...
Date: Mon, 10 Dec 2001 21:47
21 lines
1823 bytes
<3C0FBDFF.3B900505@unidata.ucar.edu> divulged:

>I'd swear the syslog messages are being buffered.  

syslog can itself be a buffer, in that some have been written to suppress
duplicate lines.  to do this they have to buffer the latest line until
another line arrives which is different or the maximum buffering period
(often hard-coded) expires.

>Or maybe something else is wrong - the messages just stopped appearing
>yesterday around 5:00 - time to quit!  But syslogd has been running for
>some time.  I don't know what else it could be.

sometimes there's a problem with the c library's handling of the syslog
function, in relation to how the daemon operates.  when the daemon is
signalled the pipe/socket being used is usually closed and in some cases
the library never notices.  check for updates to your c library or daemon.

-- 
okay, have a sig then
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads