title: Appium wait for specific log
body: <p>I'm trying to wait for certain log to appear and then do some method.
  I know that Appium can wait for elements to appear in the screen, I want to know if I can wait for log to appear from "logcat".</p>
  
  <p>Thank you.</p>
  
  <p><strong>edited:</strong> I Implemented 3 methods and <strong>IT WORKS FOR ME</strong>:</p>
  
  <pre><code>public String WaitTillLogAppearInLogcat(String i_Log, int timeOutSeconds){
      String log = null;
      LocalDateTime startTime = LocalDateTime.now();
      LocalDateTime endTime = LocalDateTime.now();
      while(log == null &amp;&amp; ((Duration.between(startTime, endTime).toMillis() / 1000) &lt; timeOutSeconds)) {
          CollectLogs();
          log = GetLogLineFromCollectedLogs(i_Log);
          endTime = LocalDateTime.now();
      }
      return log;
  }
  
  public void CollectLogs(){
      List&lt;LogEntry&gt; entireLogBuffer = androidDriver.manage().logs().get("logcat").getAll();
      for(LogEntry LogLine : entireLogBuffer) {
          launcherLogs += LogLine.getMessage();
          launcherLogs += "\n";
      }
  }
  
  
  public String GetLogLineFromCollectedLogs(String logContent) {
      String LogInCollectedLogs = null;
      String[] lines = launcherLogs.split(System.getProperty("line.separator")); 
      for (String line : lines) {
          if (line.contains(logContent)){
              LogInCollectedLogs = line;
          }
      }
      return LogInCollectedLogs;
  }
  </code></pre>
  
  <p>Where launcherLogs is String data member of the using class,
  and androidDriver is the Appium driver.</p>