Android Guides | Samples

Android.Util.Log Class

API for sending log output.

See Also: Log

Syntax

[Android.Runtime.Register("android/util/Log", DoNotGenerateAcw=true)]
public sealed class Log : Object

Remarks

API for sending log output.

Generally, use the Log.v() Log.d() Log.i() Log.w() and Log.e() methods.

The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept.

Tip: A good convention is to declare a TAG constant in your class:

java Example

private static final String TAG = "MyActivity";
and use that in subsequent calls to the log methods.

Tip: Don't forget that when you make a call like

java Example

Log.v(TAG, "index=" + i);
that when you're building the string to pass into Log.d, the compiler uses a StringBuilder and at least three allocations occur: the StringBuilder itself, the buffer, and the String object. Realistically, there is also another buffer allocation and copy, and even more pressure on the gc. That means that if your log message is filtered out, you might be doing significant work and incurring significant overhead.

[Android Documentation]

Requirements

Namespace: Android.Util
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Util.Log are listed below.

See Also: Object

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

static
Debug(String, String) : Int32
Send a Log.DEBUG log message.
static
Debug(String, Throwable, String) : Int32
static
Debug(String, String, params Object[]) : Int32
static
Debug(String, Throwable, String, params Object[]) : Int32
static
Error(String, String) : Int32
Send an Log.ERROR log message.
static
Error(String, Throwable, String) : Int32
static
Error(String, String, params Object[]) : Int32
static
Error(String, Throwable, String, params Object[]) : Int32
static
GetStackTraceString(Throwable) : String
Handy function to get a loggable stack trace from a Throwable
static
Info(String, String) : Int32
Send an Log.INFO log message.
static
Info(String, Throwable, String) : Int32
static
Info(String, String, params Object[]) : Int32
static
Info(String, Throwable, String, params Object[]) : Int32
static
IsLoggable(String, LogPriority) : Boolean
Checks to see whether or not a log for the specified tag is loggable at the specified level.
static
Verbose(String, String) : Int32
Send a Log.VERBOSE log message.
static
Verbose(String, Throwable, String) : Int32
static
Verbose(String, String, params Object[]) : Int32
static
Verbose(String, Throwable, String, params Object[]) : Int32
static
Warn(String, Throwable) : Int32
static
Warn(String, String) : Int32
Send a Log.WARN log message.
static
Warn(String, Throwable, String) : Int32
static
Warn(String, String, params Object[]) : Int32
static
Warn(String, Throwable, String, params Object[]) : Int32
static
WriteLine(LogPriority, String, String) : Int32
Low-level logging call.
static
WriteLine(LogPriority, String, String, params Object[]) : Int32
static
Wtf(String, Throwable) : Int32
What a Terrible Failure: Report an exception that should never happen.
static
Wtf(String, String) : Int32
What a Terrible Failure: Report a condition that should never happen.
static
Wtf(String, Throwable, String) : Int32
static
Wtf(String, String, params Object[]) : Int32
static
Wtf(String, Throwable, String, params Object[]) : Int32