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.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
LogcatReceiver
  public
  
  
  
  class
  LogcatReceiver
  
    extends Object
  
  
  
  
  
      implements
      
        ILogcatReceiver
      
  
  
  
    
    | java.lang.Object | 
  
  
    
      | ↳ | com.android.tradefed.device.LogcatReceiver | 
  
  
    
  Class that collects logcat in background. Continues to capture logcat even if device goes
 offline then online.
Summary
| Public constructors | 
|---|
  
  
  
    | 
      LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay)
      Creates an instance with default logcat 'threadtime' format
        
    
 | 
  
  
  
  
    | 
      LogcatReceiver(ITestDevice device, String logcatCmd, long maxFileSize, int logStartDelay)
      Creates an instance with any specified logcat command
        
    
 | 
  
Public constructors
    LogcatReceiver
    
public LogcatReceiver (ITestDevice device, 
                long maxFileSize, 
                int logStartDelay)
    
    
    
  Creates an instance with default logcat 'threadtime' format
    
    | Parameters | 
|---|
      
        | device | ITestDevice: the device to start logcat on | 
      
        | maxFileSize | long: maximum file size, earlier lines will be discarded once size is reached | 
      
        | logStartDelay | int: the delay to wait after the device becomes online | 
    
 
    LogcatReceiver
    
public LogcatReceiver (ITestDevice device, 
                String logcatCmd, 
                long maxFileSize, 
                int logStartDelay)
    
    
    
  Creates an instance with any specified logcat command
    
    | Parameters | 
|---|
      
        | device | ITestDevice: the device to start logcat on | 
      
        | logcatCmd | String: the logcat command to run (including 'logcat' part), see details on
        available options in logcat help message | 
      
        | maxFileSize | long: maximum file size, earlier lines will be discarded once size is reached | 
      
        | logStartDelay | int: the delay to wait after the device becomes online | 
    
 
Public methods
    clear
    
public void clear ()
    
    
    
  
 
    getDefaultLogcatCmd
    
public static String getDefaultLogcatCmd (ITestDevice device)
    
    
    
  Get the default logcat command, only append uid format if api level > 24.
    
    | Parameters | 
|---|
      
        | device | ITestDevice | 
    
    
 
    getLogcatData
    
public InputStreamSource getLogcatData (int maxBytes, 
                int offset)
    
    
    
  Returns the current logcat buffer given an offset.
    
    | Parameters | 
|---|
      
        | maxBytes | int: The max size of the returned buffer | 
      
        | offset | int: The offset of the full buffer. | 
    
    
 
    start
    
public void start ()
    
    
    
  
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  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 2024-10-08 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 2024-10-08 UTC."],[],[]]