diff --git a/jni/daemon/bootstages.c b/jni/daemon/bootstages.c index c062d337c..a50fe09ff 100644 --- a/jni/daemon/bootstages.c +++ b/jni/daemon/bootstages.c @@ -315,7 +315,7 @@ static void clone_skeleton(struct node_entry *node) { // Copy symlinks directly cp_afc(buf2, buf); #ifdef MAGISK_DEBUG - LOGD("cplink: %s -> %s\n",buf2, buf); + LOGI("cplink: %s -> %s\n",buf2, buf); #else LOGI("cplink: %s\n", buf); #endif @@ -414,7 +414,7 @@ static void mount_mirrors() { xmkdir_p(MIRRDIR "/system", 0755); xmount(buf, MIRRDIR "/system", "ext4", MS_RDONLY, NULL); #ifdef MAGISK_DEBUG - LOGD("mount: %s -> %s\n", buf, MIRRDIR "/system"); + LOGI("mount: %s -> %s\n", buf, MIRRDIR "/system"); #else LOGI("mount: %s\n", MIRRDIR "/system"); #endif @@ -426,7 +426,7 @@ static void mount_mirrors() { xmkdir_p(MIRRDIR "/vendor", 0755); xmount(buf, MIRRDIR "/vendor", "ext4", MS_RDONLY, NULL); #ifdef MAGISK_DEBUG - LOGD("mount: %s -> %s\n", buf, MIRRDIR "/vendor"); + LOGI("mount: %s -> %s\n", buf, MIRRDIR "/vendor"); #else LOGI("mount: %s\n", MIRRDIR "/vendor"); #endif @@ -437,7 +437,7 @@ static void mount_mirrors() { if (!seperate_vendor) { symlink(MIRRDIR "/system/vendor", MIRRDIR "/vendor"); #ifdef MAGISK_DEBUG - LOGD("link: %s -> %s\n", MIRRDIR "/system/vendor", MIRRDIR "/vendor"); + LOGI("link: %s -> %s\n", MIRRDIR "/system/vendor", MIRRDIR "/vendor"); #else LOGI("link: %s\n", MIRRDIR "/vendor"); #endif @@ -563,10 +563,10 @@ void post_fs_data(int client) { monitor_logs(); #ifdef MAGISK_DEBUG - // Start debug logs in new process + // Log everything initially debug_log_fd = xopen(DEBUG_LOG, O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, 0644); - debug_log_pid = exec_command(0, &debug_log_fd, NULL, "logcat", "-v", "brief", NULL); - close(debug_log_fd); + xwrite(debug_log_fd, "Boot logs:\n", 11); + debug_log_pid = exec_command(0, &debug_log_fd, NULL, "logcat", "-v", "thread", NULL); #endif LOGI("** post-fs-data mode running\n"); @@ -769,5 +769,8 @@ core_only: // Stop recording the boot logcat after every boot task is done kill(debug_log_pid, SIGTERM); waitpid(debug_log_pid, NULL, 0); + // Then start to log Magisk verbosely + xwrite(debug_log_fd, "\nVerbose logs:\n", 15); + debug_log_pid = exec_command(0, &debug_log_fd, NULL, "logcat", "-v", "thread", "-s", "Magisk", NULL); #endif } diff --git a/jni/daemon/log_monitor.c b/jni/daemon/log_monitor.c index bb5616e4c..9d3be1aab 100644 --- a/jni/daemon/log_monitor.c +++ b/jni/daemon/log_monitor.c @@ -26,7 +26,7 @@ static void *logger_thread(void *args) { while (1) { // Start logcat - log_pid = exec_command(0, &log_fd, NULL, "logcat", "-s", "Magisk", "-v", "thread", NULL); + log_pid = exec_command(0, &log_fd, NULL, "logcat", "-v", "thread", "Magisk:I", "*:S", NULL); if (log_pid > 0) waitpid(log_pid, NULL, 0); // For some reason it went here, clear buffer and restart diff --git a/jni/include/logging.h b/jni/include/logging.h index 63e1980c9..8727c982b 100644 --- a/jni/include/logging.h +++ b/jni/include/logging.h @@ -23,13 +23,10 @@ static inline void exit_proc() { exit(1); } static inline void exit_thread() { pthread_exit(NULL); } static inline void do_nothing() {} -// Dummy function to depress debug message -static inline void stub(const char *fmt, ...) {} - #ifdef MAGISK_DEBUG #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) #else -#define LOGD(...) stub(__VA_ARGS__) +#define LOGD(...) {} #endif #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) diff --git a/jni/utils/misc.c b/jni/utils/misc.c index 060e55dfb..d9a7ecb5f 100644 --- a/jni/utils/misc.c +++ b/jni/utils/misc.c @@ -312,7 +312,7 @@ int mkdir_p(const char *pathname, mode_t mode) { int bind_mount(const char *from, const char *to) { int ret = xmount(from, to, NULL, MS_BIND, NULL); #ifdef MAGISK_DEBUG - LOGD("bind_mount: %s -> %s\n", from, to); + LOGI("bind_mount: %s -> %s\n", from, to); #else LOGI("bind_mount: %s\n", to); #endif