vmihalko / t2_polkit

Other
0 stars 0 forks source link

Draft: polkitd: add logging for successfully loaded rules - [opened] #392

Open vmihalko opened 1 year ago

vmihalko commented 1 year ago

In GitLab by @jrybar on Aug 4, 2023, 15:54

Merges mtrapp-log-loaded-rules -> master

Log each successful load operation of a rule file including the name of the loaded file. Getting the list of active rule files from the logs is an important information in a support case and should not need additional tracing/debugging.

Built and tested on top of 4b7a5c3. The info is logged during polkitd startup and with changes of rule files, also in case '--no-debug' is set. It might be a good idea to add a log_level to the argument list of polkit_backend_authority_log() but this would affect >60 callers and is out of scope of this patch.

vmihalko commented 1 year ago

In GitLab by @dzejrou on Aug 8, 2023, 12:08

@jrybar Would it be possible to add the same log message this commit adds to the mozjs backend at:

https://gitlab.freedesktop.org/polkit/polkit/-/blob/master/src/polkitbackend/polkitbackendjsauthority.cpp#L251

for consistency? If you want me to open a separate merge requests with that patch let me know and I'll do it.

vmihalko commented 1 year ago

In GitLab by @dzejrou on Sep 21, 2023, 20:52

Patch that does that (tested on top of 67ff238cb30acc55fec853585a18afa7c71880d6 with mozjs-102):

diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
index 8263de3..efae222 100644
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -248,7 +248,9 @@ load_scripts (PolkitBackendJsAuthority  *authority)
           continue;
         }

-      //g_print ("Successfully loaded and evaluated script `%s'\n", filename);
+      polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+                                    "Successfully loaded and evaluated script %s",
+                                    filename);

       num_scripts++;
     }