title: How to store logcat output with all filters & tags in a file on SdCard?
body: <p>i am using this code to save logcat output to sdcard :-</p>
  
  <pre><code>    public String ReadFromCMD(String[] strCmdArgs)
      {
  
       ProcessBuilder cmd;
       String result="";
       try
       {
            cmd = new ProcessBuilder(strCmdArgs);
            Process process = cmd.start();
            InputStream in = process.getInputStream();
  
            BufferedReader reader = new BufferedReader(
                  new InputStreamReader(process.getInputStream()));
              int read;
              char[] buffer = new char[4096];
              StringBuffer output = new StringBuffer();
  
              process.waitFor();
  
              while ((read = reader.read(buffer)) &gt; 0) 
              {
                  output.append(buffer, 0, read);
              }
              reader.close();
              result = output.toString();
              in.close();
  
       } catch(Exception ex){ ex.printStackTrace(); }
  
       return result;
  }
  </code></pre>
  
  <p>here i am able to save logs to file.</p>
  
  <p>with this command.</p>
  
  <pre><code>String[] args_Logs_Save = "/system/bin/logcat -v time -d -b radio -b events -b main -b system".split(" ");
  ReadFromCMD(args_Logs_Save);
  </code></pre>
  
  <p>question here is :- logs save is for only my application package, not complete logcat output with "I/WifiHW, W/ActivityManager, D/hwcomposer, D/wpa_supplicant" etc tags...</p>
  
  <p>when i execute "/system/bin/logcat -v time -d -b radio -b events -b main -b system" manually from adb shell, it will execute successfully and give me all output</p>
  
  <p>but when i execute from above my code, it will only give output for my package only.</p>
  
  <p>so now what to do for getting all logcat from my above code ?</p>
  
  <p>Note:</p>
  
  <p>i am using Android 4.1 &amp; 4.2</p>
  
  <p>reference links : <a href="https://stackoverflow.com/questions/8982263/how-to-write-entire-logcat-in-to-sdcard">Link1</a>, <a href="https://stackoverflow.com/questions/12686314/logcat-output-on-sdcard">Link2</a>, <a href="https://stackoverflow.com/questions/12686314/logcat-output-on-sdcard">Link3</a>, <a href="https://stackoverflow.com/questions/6970169/stream-android-logcat-output-to-an-sd-card/9039352#9039352">Link4</a></p>
  
  <p>if you know then please help, Thanks.</p>