how to tune loglevel of libmseed?

Hi All

Q: is there any way to tune the loglevel of the libmseed library?

I’m working on a utility that use the obspy seedlink client (obspy.seedlink.slclient.SLClient() ) and from the point of retrieving streams all works nicely (well done).

However, I get a lot of output to stderr that I would like to be able to better to control in order not to have my logfile growing to absurd sizes as the utility eventually will be run 24/7.

The SLClient class have the attribute loglevel that nicely can be used to tune the log level issued by the obspy native part (through the loggin module) but this does not seem to control the output from the libmseed library which outputs a lot of:

“GE_MORC__HHZ_D: Warning: Number of blockettes in fixed header (1) does not match the number parsed (2)”

which is not really of any use as I can not control the incoming packages (afaik) and in any case as the message seems to go directly to stderr I can’t make use of the information (e.g. assembling some statistics for the stream in question or whatever).

I could of course hack and recompile the source code myself but would prefer not to. Alternatively I could intervene the output to stderr from the utility and filter it before writing to file but this seems to be an undesirable alternative to me.

Ultimately I would like to send all messages to a ring buffer and only upon request or termination of the script dump the log to file or stdout (should be relatively easy by configuring a proper logging handler I think)

Any suggestions are welcome (sorry for the lengthy post)


Anyone have any idea?


Hi Peter,

sorry for the late answer.

The seedlink client for historical reasons (I guess) does not use so tuning the log level is not possible without modifications to the code I fear. Nothing needs to be modified on the side of libmseed - only the Python code needs to be changed a bit. If you chose to go down this road please open an issue on github so it will end up in the next release of ObsPy for others to enjoy.

The normal does catch the warnings and exceptions and converts them to python warnings and exceptions which you could just turn into log messages. This is done here:� Essentially it creates Python callback functions which are called by the libmseed provided log handlers. Seems to work quite well. I think the best way is to just modify this function to use Cheers! Lion

Hi Lion

Thanks for the answer, now I know where to start looking and if I in the end end up digging into the source code I'll be happy to open an issue (still not really fluent in object oriented programming though...)