A partir de 27 de março de 2025, recomendamos usar android-latest-release
em vez de aosp-main
para criar e contribuir com o AOSP. Para mais informações, consulte Mudanças no AOSP.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
FileLogger
public
class
FileLogger
extends BaseStreamLogger<SizeLimitedOutputStream>
Subclasses diretas conhecidas
HistoryLogger |
TF History Logger, um registro especial que contém apenas alguns eventos específicos.
|
|
Um ILeveledLogOutput
que direciona as mensagens de registro para um arquivo e para o stdout.
Resumo
Métodos protegidos |
void
|
init(String logPrefix, String fileSuffix)
Alternativa a init() , em que podemos especificar o nome e o sufixo do arquivo.
|
Construtores públicos
FileLogger
public FileLogger ()
Métodos públicos
clone
public ILeveledLogOutput clone ()
Cria um novo FileLogger
com as mesmas configurações de nível de registro do objeto atual.
Não copia o conteúdo do arquivo de registro subjacente. Os dados de registro do clone serão gravados em um novo
arquivo.
closeLog
public void closeLog ()
getMaxLogSizeMbytes
public long getMaxLogSizeMbytes ()
Retorna o tamanho máximo do registro em MB.
Métodos protegidos
init
protected void init (String logPrefix,
String fileSuffix)
Alternativa a init()
, em que podemos especificar o nome e o sufixo do arquivo.
Parâmetros |
logPrefix |
String : o nome do arquivo em que fazer o registro sem a extensão. |
fileSuffix |
String : a extensão do arquivo em que fazer o registro. |
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-07-27 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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 |"]]