Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release
, bukan aosp-main
, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
FileLogger
public
class
FileLogger
extends BaseStreamLogger<SizeLimitedOutputStream>
Subclass langsung yang dikenal
HistoryLogger |
TF History Logger, log khusus yang hanya berisi beberapa peristiwa tertentu.
|
|
ILeveledLogOutput
yang mengarahkan pesan log ke file dan ke stdout.
Ringkasan
Metode yang dilindungi |
void
|
init(String logPrefix, String fileSuffix)
Alternatif untuk init() tempat kita dapat menentukan nama dan akhiran file.
|
Konstruktor publik
FileLogger
public FileLogger ()
Metode publik
clone
public ILeveledLogOutput clone ()
Membuat FileLogger
baru dengan setelan level log yang sama dengan objek saat ini.
Tidak menyalin konten file log yang mendasarinya (yaitu data log clone akan ditulis ke file
baru.)
closeLog
public void closeLog ()
getMaxLogSizeMbytes
public long getMaxLogSizeMbytes ()
Menampilkan ukuran log maksimum dalam MB.
Metode yang dilindungi
init
protected void init (String logPrefix,
String fileSuffix)
Alternatif untuk init()
tempat kita dapat menentukan nama dan akhiran file.
Parameter |
logPrefix |
String : nama file tempat logging tanpa ekstensi. |
fileSuffix |
String : ekstensi file tempat logging. |
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 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 |"]]