Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
FileLogger
public
class
FileLogger
extends BaseStreamLogger<SizeLimitedOutputStream>
Known direct subclasses
HistoryLogger |
TF History Logger, special log that contains only some specific events.
|
|
A ILeveledLogOutput
that directs log messages to a file and to stdout.
Summary
Protected methods |
void
|
init(String logPrefix, String fileSuffix)
Alternative to init() where we can specify the file name and suffix.
|
Public constructors
FileLogger
public FileLogger ()
Public methods
clone
public ILeveledLogOutput clone ()
Creates a new FileLogger
with the same log level settings as the current object.
Does not copy underlying log file content (ie the clone's log data will be written to a new
file.)
closeLog
public void closeLog ()
getMaxLogSizeMbytes
public long getMaxLogSizeMbytes ()
Returns the max log size of the log in MBytes.
Protected methods
init
protected void init (String logPrefix,
String fileSuffix)
Alternative to init()
where we can specify the file name and suffix.
Parameters |
logPrefix |
String : the file name where to log without extension. |
fileSuffix |
String : the extension of the file where to log. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-04-28 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-04-28 UTC."],[],[],null,["# FileLogger\n==========\n\n\n`\npublic\n\n\nclass\nFileLogger\n`\n\n\n`\n\n\n`\n\n`\n\n\n`\n\n`\n\nextends `[BaseStreamLogger](../../../../../../reference/tradefed/com/android/tradefed/log/BaseStreamLogger.html)`\u003c`[SizeLimitedOutputStream](../../../../../../reference/tradefed/com/android/tradefed/util/SizeLimitedOutputStream.html)`\u003e\n\n\n`\n\n`\n\n\n`\n\n|---|---|---|-------------------------------------|\n| java.lang.Object ||||\n| ↳ | [com.android.tradefed.log.BaseLeveledLogOutput](../../../../../../reference/tradefed/com/android/tradefed/log/BaseLeveledLogOutput.html) |||\n| | ↳ | [com.android.tradefed.log.BaseStreamLogger](../../../../../../reference/tradefed/com/android/tradefed/log/BaseStreamLogger.html)\\\u003c[com.android.tradefed.util.SizeLimitedOutputStream](../../../../../../reference/tradefed/com/android/tradefed/util/SizeLimitedOutputStream.html)\\\u003e ||\n| | | ↳ | com.android.tradefed.log.FileLogger |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known direct subclasses [HistoryLogger](../../../../../../reference/tradefed/com/android/tradefed/log/HistoryLogger.html) |---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------| | [HistoryLogger](../../../../../../reference/tradefed/com/android/tradefed/log/HistoryLogger.html) | TF History Logger, special log that contains only some specific events. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA [ILeveledLogOutput](../../../../../../reference/tradefed/com/android/tradefed/log/ILeveledLogOutput.html) that directs log messages to a file and to stdout.\n\nSummary\n-------\n\n| ### Public constructors ||\n|------------------------------------------------------------------------------------------------------------------|---|\n| ` `[FileLogger](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#FileLogger())`() ` |\n\n| ### Public methods ||\n|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` `[ILeveledLogOutput](../../../../../../reference/tradefed/com/android/tradefed/log/ILeveledLogOutput.html) | ` `[clone](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#clone())`() ` Creates a new [FileLogger](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html) with the same log level settings as the current object. |\n| ` void` | ` `[closeLog](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#closeLog())`() ` |\n| ` `[InputStreamSource](../../../../../../reference/tradefed/com/android/tradefed/result/InputStreamSource.html) | ` `[getLog](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#getLog())`() ` |\n| ` long` | ` `[getMaxLogSizeMbytes](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#getMaxLogSizeMbytes())`() ` Returns the max log size of the log in MBytes. |\n| ` void` | ` `[init](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#init())`() ` |\n\n| ### Protected methods ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[init](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#init(java.lang.String,%20java.lang.String))`(String logPrefix, String fileSuffix) ` Alternative to [init()](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#init()) where we can specify the file name and suffix. |\n\nPublic constructors\n-------------------\n\n### FileLogger\n\n```\npublic FileLogger ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### clone\n\n```\npublic ILeveledLogOutput clone ()\n```\n\nCreates a new [FileLogger](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html) with the same log level settings as the current object.\n\n\u003cbr /\u003e\n\nDoes not copy underlying log file content (ie the clone's log data will be written to a new file.)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------------------------------------------------------------------------------------------------------|--------|\n| [ILeveledLogOutput](../../../../../../reference/tradefed/com/android/tradefed/log/ILeveledLogOutput.html) | \u003cbr /\u003e |\n\n### closeLog\n\n```\npublic void closeLog ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### getLog\n\n```\npublic InputStreamSource getLog ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------------------------------------------------------------------------------------------------------|--------|\n| [InputStreamSource](../../../../../../reference/tradefed/com/android/tradefed/result/InputStreamSource.html) | \u003cbr /\u003e |\n\n### getMaxLogSizeMbytes\n\n```\npublic long getMaxLogSizeMbytes ()\n```\n\nReturns the max log size of the log in MBytes.\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------|--------|\n| `long` | \u003cbr /\u003e |\n\n### init\n\n```\npublic void init ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProtected methods\n-----------------\n\n### init\n\n```\nprotected void init (String logPrefix, \n String fileSuffix)\n```\n\nAlternative to [init()](../../../../../../reference/tradefed/com/android/tradefed/log/FileLogger.html#init()) where we can specify the file name and suffix.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------|----------------------------------------------------------------|\n| `logPrefix` | `String`: the file name where to log without extension. \u003cbr /\u003e |\n| `fileSuffix` | `String`: the extension of the file where to log. \u003cbr /\u003e |"]]