EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  2025  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  2025 
<== Date ==> <== Thread ==>

Subject: Re: Filtering messages print on the IOC shell console
From: Ben Franksen via Tech-talk <tech-talk at aps.anl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Thu, 26 Mar 2020 21:46:25 +0100
Am 26.03.20 um 21:25 schrieb Johnson, Andrew N. via Tech-talk:
> My philosophy about error messages is that any messages from device
> support, drivers or other background thread code should call errlog()
> (or epicsPrintf()” which a synonym for that) to report runtime
> errors. That way eltc can be used to silence them and they should
> still be logged if the IOC is connected to a log-server. The only
> place IOC code should be using printf() or fprintf(stderr, …) is when
> reporting errors from initialization commands that were run in a
> startup script or from the command-line (those should not use
> errlog() because the output gets out of sync since it has to pass
> through the logging system before being printed).

Right. And furthermore, as me and others have been preaching for years,
all such modules should (at runtime and by default) print error messages
only if the condition that causes the problem /changes/ and not every
time some record gets processed!

Both asyn and streamdevice nowadays behave this way: you get a single
message (for each record) when accessing the device fails and another
one when it works again and nothing in between (assuming the reason the
error happens stays the same, such as a lost connection).

This is really not hard to achieve. All you need to do is enumerate the
possible error states, track the current state in a struct or class
member associated with the device, and then print messages only when the
new state is different from the stored one /or/ the user has expressly
enabled verbose error output in some driver specific way. Spending this
little bit of extra effort makes life for your users so much easier.

Cheers
Ben

________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Dr. Volkmar Dietz, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Bernd Rech (Sprecher), Prof. Dr. Jan Lüning, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

Attachment: pEpkey.asc
Description: application/pgp-keys


References:
Filtering messages print on the IOC shell console Paduan Donadio, Marcio via Tech-talk
Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk
Next: Re: Filtering messages print on the IOC shell console J. Lewis Muir via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  2025 
Navigate by Thread:
Prev: Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk
Next: Re: Filtering messages print on the IOC shell console J. Lewis Muir via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  2025 
ANJ, 26 Mar 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·