Logging Output Processing

Hi everyone,
I want to make a small script in python, and I want to make log to .seiscomp/log/.

I have already tried but there is no log about the processing. The output only like this.

2025/11/12 10:12:16 [notice/Application] Starting scevalcheck
2025/11/12 10:12:16 [notice/Application] Framework : 6.5.1 Release
2025/11/12 10:12:16 [notice/Application] API Version : 16.2.0
2025/11/12 10:12:16 [notice/Application] Version : GIT HEAD: 97db6d53
Compiler: c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Build system: Linux 6.8.8-2-pve
OS: Ubuntu 22.04.4 LTS / Linux

This is my code piece to make output log processing

self._infoChannel = seiscomp.logging.getComponentChannel(seiscomp.logging.SEISCOMP_COMPONENT, ‘processing/info’, seiscomp.logging.LL_INFO)
seiscomp.logging.log(self._infoChannel, “Could not load data ‘%s’” % data)

And I want to make log like scevent-processing-info.log. How to make that?

2025/11/05 16:47:40 [processing/info/SCEVENT] … time diff of Origin/20251105094600.630465.474 to test2025scch = -38682.628297, max = 60.000000
2025/11/05 16:47:40 [processing/info/SCEVENT] … no match for Origin/20251105094600.630465.474 and test2025scch

Using the SeisComP Logging facilities with Python is not so easy when it comes to defining custom channels. Here an example, which could be of help:

import seiscomp.logging, seiscomp.system

infoChannel = seiscomp.logging.getComponentChannel("log", "processing/info", seiscomp.logging.LL_INFO)
rotator = seiscomp.logging.FileRotatorOutput(seiscomp.system.Environment.Instance().logFile("app-processing-info"), 86400, 7)
rotator.subscribe(infoChannel)
rotator.logComponent(False)

seiscomp.logging.log(infoChannel, "Output")

The component must be “log”. Anything else won’t work with Python.

Just using seiscomp.system.Environment.Instance().logFile("app-processing-info") and your own logging facilities (e.g. Python) could be a better approach.

Thank, Jan. It works.

Why in python the component mus be “log”? What is 86400, 7?

I have a look eventtool.cpp, what is _name in that file? I

string logFile = Environment::Instance()->logFile(_name + “-processing-info”);

Unfortunately I can just reply: because. If you are really interested in the reason then read the logging library sources and try to understand, how that whole component mapping works and when it will be evaluated. I don’t want to offend you with my reply, it is just a bit difficult to explain. Take your time and digest the code.

That are the parameters for the log file rotator. One day of log entries, rotate 7 days and delete older files.

That is the name of application, scevent in that case.

Okay, Jan. This has been very helpful.

Honestly, I want to make a plugin in c++, I’ve tried to understand unit testing to check before deployment but I’m still confused. However, I will slowly try to understand it again.

Can you share the tips to test the code before deployment?