Open Bug 1073140 Opened 10 years ago Updated 2 years ago

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

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect

Tracking

(Not tracked)

People

(Reporter: ahal, Unassigned)

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
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.