Opened 11 years ago

Closed 11 years ago

#6237 closed patch (fixed)

Enable mythfrontend --logfile logging early to get all info into log file

Reported by: sphery <mtdean@…> Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: MythTV - General Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In mythfrontend, the arg processing functionality waits until after the creation of MythContext to parse the --logfile option. Therefore, the following information is output to stdout, rather than the logfile:

2009-02-06 18:21:59.425 mythfrontend version: trunk [19949] www.mythtv.org
2009-02-06 18:21:59.427 Using runtime prefix = /usr/local
2009-02-06 18:22:00.230 Empty LocalHostName.
2009-02-06 18:22:00.230 Using localhost value of mythhostname
2009-02-06 18:22:00.244 New DB connection, total: 1
2009-02-06 18:22:00.248 Connected to database 'mythconverg' at host: localhost
2009-02-06 18:22:00.250 Closing DB connection named 'DBManager0'
2009-02-06 18:22:00.380 ScreenSaverX11Private: XScreenSaver support enabled
2009-02-06 18:22:00.382 DPMS is active.
2009-02-06 18:22:00.387 Primary screen: 0.
2009-02-06 18:22:00.388 Connected to database 'mythconverg' at host: localhost
2009-02-06 18:22:00.390 Using screen 0, 1920x1200 at 0,0
2009-02-06 18:22:00.410 MythUI Image Cache size set to 20971520 bytes

After this point, VERBOSE output is written to the logfile, starting with:

2009-02-06 18:22:00.411 Enabled verbose msgs:  important general

meaning that useful diagnostic information such as the version and runtime prefix and hostname are not included in the logfile.

The attached patch simply rearranges the arg processing to parse the --logfile argument and open the logfile, when appropriate, before the creation of MythContext.

The "mythfrontend version" line of code is actually duplicated in the conditional verifying successful opening of the logfile, since the one that occurs before the argument processing is used for --help, so couldn't be moved after arg processing. The extra line of code only executes when --logfile is used, meaning that the version information will be printed once on stderr and once in the log file.

Much of the benefit of this patch comes from the fact that the log file will contain the version information, making it easier to diagnose reported problems.

Attachments (1)

mythtv-enable_mythfrontend_logging_early.patch (3.4 KB) - added by sphery <mtdean@…> 11 years ago.

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by sphery <mtdean@…>

comment:1 Changed 11 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [19950]) Move the --logfile command line option parsing in mythfrontend to before we init MythContext so that all possible VERBOSE output is sent to the logfile.

Closes #6237 using patch by Michael T. Dean.

Note: See TracTickets for help on using tickets.