wsd: allow tracing with anonymization

Useful for troubleshooting and other non-prod setups.

To enable, add a subnode under logging/anonymize in
loolwsd.xml called allow_logging_pii with a boolean
value of true:

<logging>
  <anonymize>
    <allow_logging_pii>true</allow_logging_pii>
  </anonymize>
</logging>

Reviewed-on: https://gerrit.libreoffice.org/56568
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 829b4722817b89445701a378ffa6b597b906bb7d)

Change-Id: If74acaac0ea442ee5a7860453182180663a5108b
This commit is contained in:
Ashod Nakashian 2018-06-28 00:47:20 -04:00
parent c93f98d8c4
commit 1d814fca8c

View file

@ -870,7 +870,7 @@ void LOOLWSD::initialize(Application& self)
if (AnonymizeFilenames || AnonymizeUsernames)
{
if (LogLevel == "trace")
if (LogLevel == "trace" && !getConfigValue<bool>(conf, "logging.anonymize.allow_logging_pii", false))
{
const char failure[] = "Anonymization and trace-level logging are incompatible. "
"Please reduce logging level to debug or lower in loolwsd.xml to prevent leaking sensitive user data.";
@ -885,7 +885,7 @@ void LOOLWSD::initialize(Application& self)
const auto logToFile = getConfigValue<bool>(conf, "logging.file[@enable]", false);
std::map<std::string, std::string> logProperties;
for (size_t i = 0; ; ++i)
for (std::size_t i = 0; ; ++i)
{
const std::string confPath = "logging.file.property[" + std::to_string(i) + "]";
const std::string confName = config().getString(confPath + "[@name]", "");