Is it possible to set the log levels on a device that is not rooted? so I want to change the device log level somehow to "debug". is this something that can be done?
since its not rooted i dont think setprop will work. i can also not change the local.prop file since i do not have permissions to do so.
other than maybe getting lucky and finding a hidden menu that has the log levels in it. is there a way for me to enhance the log level some other way?
thanks for the help.
FINEST indicates a highly detailed tracing message. INFO is a message level for informational messages. OFF is a special level that can be used to turn off logging. SEVERE is a message level indicating a serious failure.
To change log levels, as a root user, perform the following: To enable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=DEBUG) To disable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=INFO)
setprop
:
local.prop
which is only possible on rooted phones.Loglevels:
Log.d()
then it will be on "debug" level and you can't change that unless you change the code and recompile it. There is nothing that hides log messages if you execute a Log.?
regardless of level.if (LOCAL_LOGV) Log.v(...
- you need to change the code here to see those too.Config.LOGV
(= always false
) see Config. No way to change the broken behaviour here either. You need to recompile.example
public static final boolean DEBUG_SQL_CACHE =
Log.isLoggable("SQLiteCompiledSql", Log.VERBOSE);
// somewhere in code
if (SQLiteDebug.DEBUG_SQL_CACHE) {
Log.d(TAG, "secret message!");
}
if you do adb shell setprop log.tag.SQLiteCompiledSql VERBOSE
you should see those messages popping up. Log#isLoggable()
There is no global loglevel I know of.
Let me suggest a tiny replacement for the standard log class (I'm the author)
https://github.com/zserge/log
It's backwards compatible, so you only need to modify your imports. Then you can set the minimal log level for your app via Log.level(Log.D)
or Log.level(Log.W)
etc, or you can disable logs using Log.useLog(false)
. No need to modify your existing logging code.
Despite of its small size this logger works with both, JVM and Android, allows you to skip the "tag" parameter, simplifies logging of multiple values separated by commas or using a format string. So it's really convenient, easy to migrate to, and only adds ~4 kilobytes to your APK size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With