Skip to content

Commit

Permalink
Add an option to save a full logcat
Browse files Browse the repository at this point in the history
Can be activated by creating a file:
  /data/data/de.robv.android.xposed.installer/conf/log_all

Could be useful to capture logcats for reporting bugs, especially for
boot loops.
  • Loading branch information
rovo89 committed May 18, 2016
1 parent 894ccc1 commit 9a54ffb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
29 changes: 18 additions & 11 deletions xposed_logcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <unistd.h>

#include "xposed.h"
#include "xposed_service.h"
#include "xposed_logcat.h"


Expand All @@ -37,17 +38,23 @@ static void execLogcat() {
xposed::dropCapabilities(keep);

// Execute a logcat command that will keep running in the background
execl("/system/bin/logcat", "logcat",
"-v", "time", // include timestamps in the log
"-s", // be silent by default, except for the following tags
"XposedStartupMarker:D", // marks the beginning of the current log
"Xposed:I", // Xposed framework and default logging
"appproc:I", // app_process
"XposedInstaller:I", // Xposed Installer
"art:F", // ART crashes
"libc:F", // Native crashes
"DEBUG:I", // Native crashes
(char*) 0);
if (zygote_access(XPOSEDLOG_CONF_ALL, F_OK) == 0) {
execl("/system/bin/logcat", "logcat",
"-v", "time", // include timestamps in the log
(char*) 0);
} else {
execl("/system/bin/logcat", "logcat",
"-v", "time", // include timestamps in the log
"-s", // be silent by default, except for the following tags
"XposedStartupMarker:D", // marks the beginning of the current log
"Xposed:I", // Xposed framework and default logging
"appproc:I", // app_process
"XposedInstaller:I", // Xposed Installer
"art:F", // ART crashes
"libc:F", // Native crashes
"DEBUG:I", // Native crashes
(char*) 0);
}

// We only get here in case of errors
ALOGE("Could not execute logcat: %s", strerror(errno));
Expand Down
7 changes: 4 additions & 3 deletions xposed_logcat.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef XPOSED_LOGCAT_H_
#define XPOSED_LOGCAT_H_

#define XPOSEDLOG XPOSED_DIR "log/error.log"
#define XPOSEDLOG_OLD XPOSEDLOG ".old"
#define XPOSEDLOG_MAX_SIZE 5*1024*1024
#define XPOSEDLOG XPOSED_DIR "log/error.log"
#define XPOSEDLOG_OLD XPOSEDLOG ".old"
#define XPOSEDLOG_CONF_ALL XPOSED_DIR "conf/log_all"
#define XPOSEDLOG_MAX_SIZE 5*1024*1024

namespace xposed {
namespace logcat {
Expand Down

0 comments on commit 9a54ffb

Please sign in to comment.