Update vold to log only debug or higher level messages.

This will allow adding lots of verbose logs which can be enabled
only during local testing/debugging. Update the existing verbose
level logs to debug level since we want those to be logged by
default.

Test: manual
Change-Id: Ib05e2b6efa71308458d49affb6ed81d3975b28ab
This commit is contained in:
Sudheer Shanka 2018-09-21 10:54:54 -07:00
parent 15b9656ae9
commit 4b6ca4ea65
9 changed files with 23 additions and 23 deletions

View file

@ -137,12 +137,12 @@ static status_t benchmarkInternal(const std::string& rootPath,
// Only drop when we haven't aborted // Only drop when we haven't aborted
if (res == OK) { if (res == OK) {
android::base::Timer timer; android::base::Timer timer;
LOG(VERBOSE) << "Before drop_caches"; LOG(DEBUG) << "Before drop_caches";
if (!WriteStringToFile("3", "/proc/sys/vm/drop_caches")) { if (!WriteStringToFile("3", "/proc/sys/vm/drop_caches")) {
PLOG(ERROR) << "Failed to drop_caches"; PLOG(ERROR) << "Failed to drop_caches";
res = -1; res = -1;
} }
LOG(VERBOSE) << "After drop_caches"; LOG(DEBUG) << "After drop_caches";
sync(); sync();
if (res == OK) extras->putLong(String16("drop"), timer.duration().count()); if (res == OK) extras->putLong(String16("drop"), timer.duration().count());
} }

View file

@ -252,7 +252,7 @@ int Devmapper::destroyAll() {
} }
} }
} else { } else {
LOG(VERBOSE) << "Found unmanaged dm device named " << name; LOG(DEBUG) << "Found unmanaged dm device named " << name;
} }
nxt = n->next; nxt = n->next;
} while (nxt); } while (nxt);

View file

@ -145,7 +145,7 @@ static int flush_outstanding_data(struct encryptGroupsData* data) {
return 0; return 0;
} }
LOG(VERBOSE) << "Copying " << data->count << " blocks at offset " << data->offset; LOG(DEBUG) << "Copying " << data->count << " blocks at offset " << data->offset;
if (pread64(data->realfd, data->buffer, info.block_size * data->count, data->offset) <= 0) { if (pread64(data->realfd, data->buffer, info.block_size * data->count, data->offset) <= 0) {
LOG(ERROR) << "Error reading real_blkdev " << data->real_blkdev << " for inplace encrypt"; LOG(ERROR) << "Error reading real_blkdev " << data->real_blkdev << " for inplace encrypt";

View file

@ -146,7 +146,7 @@ int Loop::destroyAll() {
PLOG(WARNING) << "Failed to LOOP_CLR_FD " << path; PLOG(WARNING) << "Failed to LOOP_CLR_FD " << path;
} }
} else { } else {
LOG(VERBOSE) << "Found unmanaged loop device at " << path << " named " << id; LOG(DEBUG) << "Found unmanaged loop device at " << path << " named " << id;
} }
} }

View file

@ -265,9 +265,9 @@ status_t ForkExecvp(const std::vector<std::string>& args, security_context_t con
for (size_t i = 0; i < argc; i++) { for (size_t i = 0; i < argc; i++) {
argv[i] = (char*)args[i].c_str(); argv[i] = (char*)args[i].c_str();
if (i == 0) { if (i == 0) {
LOG(VERBOSE) << args[i]; LOG(DEBUG) << args[i];
} else { } else {
LOG(VERBOSE) << " " << args[i]; LOG(DEBUG) << " " << args[i];
} }
} }
@ -300,9 +300,9 @@ status_t ForkExecvp(const std::vector<std::string>& args, std::vector<std::strin
for (size_t i = 0; i < args.size(); i++) { for (size_t i = 0; i < args.size(); i++) {
cmd += args[i] + " "; cmd += args[i] + " ";
if (i == 0) { if (i == 0) {
LOG(VERBOSE) << args[i]; LOG(DEBUG) << args[i];
} else { } else {
LOG(VERBOSE) << " " << args[i]; LOG(DEBUG) << " " << args[i];
} }
} }
output.clear(); output.clear();
@ -327,7 +327,7 @@ status_t ForkExecvp(const std::vector<std::string>& args, std::vector<std::strin
} }
char line[1024]; char line[1024];
while (fgets(line, sizeof(line), fp) != nullptr) { while (fgets(line, sizeof(line), fp) != nullptr) {
LOG(VERBOSE) << line; LOG(DEBUG) << line;
output.push_back(std::string(line)); output.push_back(std::string(line));
} }
if (pclose(fp) != 0) { if (pclose(fp) != 0) {
@ -344,9 +344,9 @@ pid_t ForkExecvpAsync(const std::vector<std::string>& args) {
for (size_t i = 0; i < argc; i++) { for (size_t i = 0; i < argc; i++) {
argv[i] = (char*)args[i].c_str(); argv[i] = (char*)args[i].c_str();
if (i == 0) { if (i == 0) {
LOG(VERBOSE) << args[i]; LOG(DEBUG) << args[i];
} else { } else {
LOG(VERBOSE) << " " << args[i]; LOG(DEBUG) << " " << args[i];
} }
} }
@ -686,7 +686,7 @@ dev_t GetDevice(const std::string& path) {
} }
status_t RestoreconRecursive(const std::string& path) { status_t RestoreconRecursive(const std::string& path) {
LOG(VERBOSE) << "Starting restorecon of " << path; LOG(DEBUG) << "Starting restorecon of " << path;
static constexpr const char* kRestoreconString = "selinux.restorecon_recursive"; static constexpr const char* kRestoreconString = "selinux.restorecon_recursive";
@ -695,7 +695,7 @@ status_t RestoreconRecursive(const std::string& path) {
android::base::WaitForProperty(kRestoreconString, path); android::base::WaitForProperty(kRestoreconString, path);
LOG(VERBOSE) << "Finished restorecon of " << path; LOG(DEBUG) << "Finished restorecon of " << path;
return OK; return OK;
} }

View file

@ -176,8 +176,8 @@ void VolumeManager::handleBlockEvent(NetlinkEvent* evt) {
std::lock_guard<std::mutex> lock(mLock); std::lock_guard<std::mutex> lock(mLock);
if (mDebug) { if (mDebug) {
LOG(VERBOSE) << "----------------"; LOG(DEBUG) << "----------------";
LOG(VERBOSE) << "handleBlockEvent with action " << (int)evt->getAction(); LOG(DEBUG) << "handleBlockEvent with action " << (int)evt->getAction();
evt->dump(); evt->dump();
} }

View file

@ -53,17 +53,17 @@ using android::base::StringPrintf;
int main(int argc, char** argv) { int main(int argc, char** argv) {
atrace_set_tracing_enabled(false); atrace_set_tracing_enabled(false);
setenv("ANDROID_LOG_TAGS", "*:v", 1); setenv("ANDROID_LOG_TAGS", "*:d", 1);
android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM));
LOG(INFO) << "Vold 3.0 (the awakening) firing up"; LOG(INFO) << "Vold 3.0 (the awakening) firing up";
ATRACE_BEGIN("main"); ATRACE_BEGIN("main");
LOG(VERBOSE) << "Detected support for:" LOG(DEBUG) << "Detected support for:"
<< (android::vold::IsFilesystemSupported("ext4") ? " ext4" : "") << (android::vold::IsFilesystemSupported("ext4") ? " ext4" : "")
<< (android::vold::IsFilesystemSupported("f2fs") ? " f2fs" : "") << (android::vold::IsFilesystemSupported("f2fs") ? " f2fs" : "")
<< (android::vold::IsFilesystemSupported("vfat") ? " vfat" : ""); << (android::vold::IsFilesystemSupported("vfat") ? " vfat" : "");
VolumeManager* vm; VolumeManager* vm;
NetlinkManager* nm; NetlinkManager* nm;

View file

@ -105,7 +105,7 @@ status_t EmulatedVolume::doMount() {
nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME); nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME);
while (before == GetDevice(mFuseWrite)) { while (before == GetDevice(mFuseWrite)) {
LOG(VERBOSE) << "Waiting for FUSE to spin up..."; LOG(DEBUG) << "Waiting for FUSE to spin up...";
usleep(50000); // 50ms usleep(50000); // 50ms
nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME); nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME);

View file

@ -202,7 +202,7 @@ status_t PublicVolume::doMount() {
nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME); nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME);
while (before == GetDevice(mFuseWrite)) { while (before == GetDevice(mFuseWrite)) {
LOG(VERBOSE) << "Waiting for FUSE to spin up..."; LOG(DEBUG) << "Waiting for FUSE to spin up...";
usleep(50000); // 50ms usleep(50000); // 50ms
nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME); nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME);