Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a build time switch to disable logging in optimized builds #1103

Closed
kaie opened this issue Apr 19, 2020 · 9 comments · Fixed by #1125
Closed

Provide a build time switch to disable logging in optimized builds #1103

kaie opened this issue Apr 19, 2020 · 9 comments · Fixed by #1125

Comments

@kaie
Copy link
Contributor

kaie commented Apr 19, 2020

During execution with real world keys, RNP dumps lots of warnings on the console, apparently from RNP_LOG

Could you please provide a mechanism to disable those in an optimized build?

[signature_parse_subpacket() /home/user/moz/commcent/mozilla/comm/third_party/rnp/src/librepgp/stream-packet.cpp:1420] unknown subpacket : 101
[signature_check_certification() /home/user/moz/commcent/mozilla/comm/third_party/rnp/src/librepgp/stream-sig.cpp:1203] key expired 3065799 seconds ago
[signature_check_binding() /home/user/moz/commcent/mozilla/comm/third_party/rnp/src/librepgp/stream-sig.cpp:1239] subkey expired 71184103 seconds ago
[signature_check() /home/user/moz/commcent/mozilla/comm/third_party/rnp/src/librepgp/stream-sig.cpp:1155] signature made after key expiration
[signed_src_finish() /home/user/moz/commcent/mozilla/comm/third_party/rnp/src/librepgp/stream-parse.cpp:936] signer's key not found
@ni4
Copy link
Contributor

ni4 commented Apr 20, 2020

Sure, while it is easy to completely disable this (or just remove some noisy lines), shouldn't we have some sort of fallback to be able to debug later on? I.e. to have some data for the users to send it back.

@kaie
Copy link
Contributor Author

kaie commented Apr 20, 2020

Maybe check for an environment variable at startup, and remember the flag during the runtime? If set, then log.

@ni4
Copy link
Contributor

ni4 commented Apr 20, 2020

Yeah, this sounds as a solution. What do you think, @dewyatt? cc @ronaldtse, @rrrooommmaaa

@kaie
Copy link
Contributor Author

kaie commented Apr 20, 2020

#ifdef DEBUG then log
#else
if getenv("RNP_LOG_CONSOLE") then log
else silence
#endif

@ni4
Copy link
Contributor

ni4 commented Apr 20, 2020

My only concern here is performance in case of large amount of log messages. Probably better to keep some global inner state variable.

@ronaldtse
Copy link
Contributor

Probably better to keep some global inner state variable.

Agree with @ni4 .

@dewyatt
Copy link
Contributor

dewyatt commented Apr 20, 2020 via email

@ni4
Copy link
Contributor

ni4 commented Apr 20, 2020

Okay, so let's stick to this strategy:

  • for Debug builds logging is always on
  • for Release builds logging is enabled (storing status in some global variable) only if RNP_LOG_CONSOLE environment variable is set.
  • we'll need to have some small test for this as well.

@rrrooommmaaa Would you like to take this issue?

@ronaldtse
Copy link
Contributor

Anyone interested in this? We need to get this going. Thanks!

Ping @rrrooommmaaa @joke325 .

@ronaldtse ronaldtse added this to To do in Ongoing via automation May 1, 2020
@rrrooommmaaa rrrooommmaaa self-assigned this May 5, 2020
@ni4 ni4 added this to the v0.14.0 milestone May 12, 2020
@ni4 ni4 added the high-prio label May 12, 2020
Ongoing automation moved this from To do to Done May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Ongoing
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants