Don't create corrupt DB logger until we need to write a corrupt DB log

RESOLVED FIXED

Status

()

Firefox for iOS
General
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: rnewman, Assigned: Maurya Talisetti, Mentored)

Tracking

unspecified
All
iOS

Firefox Tracking Flags

(fxios-v4.0 affected, fxios-v5.0 fixed)

Details

(Whiteboard: [good first bug][lang=swift])

Attachments

(2 attachments)

(Reporter)

Description

3 years ago
2015-11-24 22:56:20.861 [Debug] [AppDelegate.swift:60] startApplication(_:withLaunchOptions:) > Creating corrupt DB logger…
2015-11-24 22:56:21.365 [Info] > XCGLogger writing to log to: file:///Users/rnewman/Library/Developer/CoreSimulator/Devices/522A062C-9D9F-4011-BC6C-972FA475A849/data/Containers/Data/Application/FBAEBC48-46BC-477E-8CA7-CE50CAB358F4/Library/Caches/Logs/corruptLogger.20151124T225621-0800.log
2015-11-24 22:56:21.366 [Info] [RollingFileLogger.swift:46] newLogWithDate > Created file destination for logger with root: corruptLogger and timestamp: 2015-11-25 06:56:21 +0000
(Reporter)

Updated

3 years ago
Mentor: sleroux
Whiteboard: [good first bug][lang=swift]
(Assignee)

Updated

2 years ago
Assignee: nobody → maurya1985
(Assignee)

Updated

2 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 1

2 years ago
Stephan, to start with we can disable creation of a new log file in the AppDelegate.swift:

        //log.debug("Creating corrupt DB logger…")
        //Logger.corruptLogger.newLogWithDate(logDate)

Any logs to corruptLogger are now going to the stdout.

So, are we expecting individual developers to create their own corrupt DB logger if they intend to log to it? Wouldn't multiple developers end up creating multiple such log files?
Flags: needinfo?(sleroux)
> So, are we expecting individual developers to create their own corrupt DB logger if they intend to log to it? Wouldn't multiple developers end up creating multiple such log files?

We'd still want to be able to log corrupt database information on non-developer builds. This bug address more the fact that we _always_ create the logger which in turn writes a corruptLog.log file on disk even when no corruption occurs. Instead of creating the logger in the AppDelegate, I would investigate where we actually use the logger and create the newLog there. I believe the only place is here: https://github.com/mozilla/firefox-ios/blob/master/Storage/ThirdParty/SwiftData.swift#L666
Flags: needinfo?(sleroux)
(Assignee)

Comment 3

2 years ago
Created attachment 8748753 [details] [review]
Pull request
Attachment #8748753 - Flags: review?(sleroux)
Comment on attachment 8748753 [details] [review]
Pull request

Left feedback on the PR.
Attachment #8748753 - Flags: feedback+
(Assignee)

Comment 5

2 years ago
Created attachment 8749632 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1783
Attachment #8749632 - Flags: review?(sleroux)
Comment on attachment 8749632 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1783

Thanks for the patch Maurya!
Attachment #8749632 - Flags: review?(sleroux) → review+
master e57f4b333f91dc8711a5e85d5db0ac2f78a7107e
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-fxios-v4.0: --- → affected
status-fxios-v5.0: --- → fixed
Resolution: --- → FIXED
Attachment #8748753 - Flags: review?(sleroux)
You need to log in before you can comment on or make changes to this bug.