Closed Bug 1617213 Opened 4 years ago Closed 4 years ago

MOZ_LOG doesn't allow module names with the dot character

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: kats, Assigned: kats)

Details

Attachments

(1 file)

I tried making a LazyLogModule with a name like apz.mgr and while it didn't give me any errors, setting MOZ_LOG="apz.mgr:5" didn't produce the expected output. Turns out the code that parses the env var uses a Tokenizer that splits "words" and so the . splits apz.mgr:5 into three words instead of doing what I expected.

If this is intentional it should be documented on the MDN page and if it's not then I can provide a patch to fix by adding . to the set of allowed word characters.

erahm, thoughts?

Flags: needinfo?(erahm)

Allowing a . in a log name seems reasonable. I'm okay with adding support for this, but one thing to check is whether that messes with setting the log level at runtime via prefs. Please update the tests when you make this change.

Flags: needinfo?(erahm)

Thanks. I'll put up a patch shortly. I tested setting prefs like logging.apz.mgr = 5 and it does have the desired effect (as I would expect from reading the relevant code as well).

Updated MDN page as well: https://wiki.developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Gecko_Logging$compare?locale=en-US&to=1608910&from=1588892

Assignee: nobody → kats
Status: NEW → ASSIGNED
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4d34791140cb
Allow dot characters in log module names. r=erahm
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: