You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixoppia#5232: ConsoleLogger overwrites local log file for each line write (oppia#5550)
## Explanation
Fixoppia#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]>
0 commit comments