-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #5232: ConsoleLogger overwrites local log file for each line write (
#5550) ## Explanation Fix #5232 This PR updates the `ConsoleLogger` class to improve logging functionality. The key changes include: - **Append Mode for Logs**: The `FileWriter` is now opened in append mode, ensuring that new log entries are added to the existing log file instead of overwriting it. - **Long-lived PrintWriter**: A long-lived `PrintWriter` instance has been implemented to enhance performance by reducing the overhead of opening and closing the log file multiple times. - **Close Log File**: A `closeLogFile()` method has been added to properly close the `PrintWriter`, preventing resource leaks after logging is complete. These changes address the issue of logs being overwritten and enhance performance while ensuring proper resource management. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). --------- Co-authored-by: Adhiambo Peres <[email protected]>
- Loading branch information
1 parent
32077ab
commit 96f5289
Showing
2 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters