Improve logging#760
Conversation
Fixes: 8dc25d7 ('kpatch-build: let user specify kpatch module name') Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Replace stray spaces with tabs, except in the usage output where tabs don't make much sense. Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
This can be used for building a kpatch module for a non-running kernel. Note that the correct kernel and debug packages still need to be installed. Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
The current checks never fail, because the first grep in the pipeline doesn't write anything to stdout. Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
When searching for 'Linux version ...' in vmlinux, stop after the first match so that we don't keep reading a potentially huge file. Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
|
This is a nice improvement, but as somebody who uses the -d flag a lot, the thing I most often care about is the kpatch-build xtrace (along with the preserving of ~/.kpatch/tmp). So what do you think about the following?
|
|
I usually want all the debug output on stdout but without the xtrace noise :-) How about we keep -d as is (without xtrace in kpatch-gcc) and add another flag for the new behaviour? |
Add a logger funcition that can be used to log to both stdout and the logfile or only to the logfile. This is needed for subsequent patches where we introduce an alternate debug mode. Since we're piping to a logger now, we need to set 'pipefail' otherwise the return status of such a pipeline is always 0 (the exit status of the logger) and we won't catch any errors. From the bash manpage: The return status of a pipeline is the exit status of the last command, unless the pipefail option is enabled Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
|
How about this: https://github.com/juergh/kpatch/tree/improve-logging-v2 |
|
That could work, but I'd like to try to keep the debug options as simple as we can. I'm ok with running kpatch-build as
Then I can run |
|
Hmmm.... I want to make this non-intrusive, i.e., not change the current behaviour. How about adding -dd, -ddd, -dddd for the other debug modes. Simple enough: https://github.com/juergh/kpatch/tree/improve-logging-v3 |
|
Ok, that sounds good. |
4e82207 to
78b12b3
Compare
|
Force pushed to branch improve-logging. |
|
Sorry, for the delay, we'll try to merge #759 soon. This new commit isn't working for me. getopt is interpreting "-dd" as "-d -d", so it just enables xtrace but nothing else. |
By specifying -d, --debug multiple times, the following additional
debug modes can be enabled:
-d -d: Writes everything that is written to the logfile also to
stdout.
-d -d -d: Same as '-d -d' plus sets 'xtrace' in kpatch-build.
-d -d -d -d: Same as '-d -d -d' plus sets 'xtrace' in kpatch-gcc.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
78b12b3 to
757bc71
Compare
|
👍 |
|
The latest version works as expected. Thanks @juergh |
debug option is now accepting multiple -d arguments dynup/kpatch#760
debug option is now accepting multiple -d arguments dynup/kpatch#760
debug option is now accepting multiple -d arguments dynup/kpatch#760
No description provided.