[mozlog] commandline.py overwrites user specified 'mach' formatter if no sys.stdout loggers found

NEW
Unassigned

Status

defect
5 years ago
5 years ago

People

(Reporter: ahal, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

E.g say I run:
python foo.py --log-mach path/to/log

If no stdout_loggers are found, commandline.py will automatically point the 'mach' formatter at sys.stdout [1]. However, this overwrites the user specified logfile. So in the above example, no output appears in 'path/to/log'.

The workaround is to explicitly pass in a stdout_logger on the command line:
python foo.py --log-mach path/to/log --log-mach -.

In my case, I'm setting up a daemon and don't want anything logged to stdout. I question whether we should be setting this up automatically at all (assuming the user passes in a file).. though I guess it doesn't really hurt.

[1] http://dxr.mozilla.org/mozilla-central/source/testing/mozbase/mozlog/mozlog/structured/commandline.py#175
You need to log in before you can comment on or make changes to this bug.