Debugging custom promise types #4526
-
When debugging custom promise types I use the following command $ cf-agent -KId /var/cfengine/masterfiles/services/my_policy.cf #policy file using my custom promise module which produces a lot of noise. Sometimes I'm only interested in log messages from the custom promise module. Thus, I'm wondering if there is some way to only capture these log messages? E.g. the following is a bit redundant
It can be a bit confusing when cfengine.py catches an unhandled exception, logging each line from the stack trace, line by line, twice. I guess running the module without cf-agent is a possible answer to this question. But I find it a bit sub-optimal. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
How to only see log messages from module?
Currently not possible, built-in, but you can make a workaround:
Assuming the module doesn't use JSON protocol for logging, and that the log messages appear directly after the line received messages. DetailsWe don't have separate levels of debug logging, which could help in this way.
Maybe, but the first line is very useful to see exactly what data is being received from the module, the second is just logging working as intended.
MIght be a good approach in many situations. Filtering log output with grepHere's some more nifty examples.
Only the lines following a
Only lines received from module:
Exclude lines received from module:
Only debug messages:
Only debug messages and excluding line received messages:
Feature requests
I think we could change the python library to send the whole stack trace in one (JSON) log message, which would work around this specific case: https://tracker.mender.io/browse/CFE-3600
Created a ticket for this: https://tracker.mender.io/browse/CFE-3601 |
Beta Was this translation helpful? Give feedback.
-
Probably it won't help here, but I think that
|
Beta Was this translation helpful? Give feedback.
How to only see log messages from module?
Currently not possible, built-in, but you can make a workaround:
Assuming the module doesn't use JSON protocol for logging, and that the log messages appear directly after the line received messages.
Details
We don't have separate levels …