Closed Bug 1390736 Opened 7 years ago Closed 7 years ago

Make it possible to set RUST_LOG on content process only

Categories

(Core :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: xidorn, Assigned: jryans)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Stylo has lots of stuff printing in log, which sometimes can be very useful.

However, setting RUST_LOG directly would have it print log for both the chrome process and content process, which is not always desirable, especially given that all SVG images in chrome are now styled by stylo.

jryans has a patch [1] to take a "RUST_LOG_CHILD" environment for having it separately, which seems to be pretty useful. We probably should land something like that.


[1] https://github.com/jryans/gecko-dev/commit/4cfcac5b7512d1cadab700708e48e142f234e395
Assignee: nobody → jryans
Status: NEW → ASSIGNED
Comment on attachment 8900934 [details]
Bug 1390736 - Add RUST_LOG_CHILD for child-only logging.

https://reviewboard.mozilla.org/r/172384/#review179084

Do you know if there's some obvious place we can document this?  Maybe a centralized logging wiki page?

::: ipc/glue/GeckoChildProcessHost.cpp:618
(Diff revision 1)
> +    rustLog.AssignLiteral("RUST_LOG=");
> +    rustLog.Append(childRustLog);
> +    PR_SetEnv(rustLog.get());
> +  }
> +
>    bool retval = PerformAsyncLaunchInternal(aExtraOpts, arch);

It occurs to me that we should really have a way of launching processes with extra environment variables, rather than trying to shoehorn in environment variables the way it's done above.  (This is not intended as a criticism of your approach.)

Maybe we tried that already and it doesn't work well, for some reason...
Attachment #8900934 - Flags: review?(nfroyd) → review+
Comment on attachment 8900934 [details]
Bug 1390736 - Add RUST_LOG_CHILD for child-only logging.

https://reviewboard.mozilla.org/r/172384/#review179084

It took a while to find, but the Gecko Logging[1] page seemed reasonable enough.  I added general Rust logging notes and mentioned this new thing too.

[1]: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Gecko_Logging

> It occurs to me that we should really have a way of launching processes with extra environment variables, rather than trying to shoehorn in environment variables the way it's done above.  (This is not intended as a criticism of your approach.)
> 
> Maybe we tried that already and it doesn't work well, for some reason...

Yeah, something more general could be useful!  Not sure if there would be any security / sandboxing implications with a more general env var munging system that applies only to certain processes...

I'll mention this new thing on dev-platform, and we can consider something more general if people think there's a need.
Pushed by jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/1e8c41b9bcc8
Add RUST_LOG_CHILD for child-only logging. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/1e8c41b9bcc8
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: