Partager via


Log.IsLoggable(String, LogPriority) Method

Definition

Checks to see whether or not a log for the specified tag is loggable at the specified level.

[Android.Runtime.Register("isLoggable", "(Ljava/lang/String;I)Z", "")]
public static bool IsLoggable (string? tag, Android.Util.LogPriority level);
[<Android.Runtime.Register("isLoggable", "(Ljava/lang/String;I)Z", "")>]
static member IsLoggable : string * Android.Util.LogPriority -> bool

Parameters

tag
String

The tag to check.

level
LogPriority

The level to check.

Returns

Whether or not that this is allowed to be logged.

Attributes

Exceptions

is thrown if the tag.length() > 23.

Remarks

Checks to see whether or not a log for the specified tag is loggable at the specified level.

The default level of any tag is set to INFO. This means that any level above and including INFO will be logged. Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag.&lt;YOUR_LOG_TAG> &lt;LEVEL>' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, or ASSERT. You can also create a local.prop file that with the following in it: 'log.tag.&lt;YOUR_LOG_TAG>=&lt;LEVEL>' and place that in /data/local.prop.

Java documentation for android.util.Log.isLoggable(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to