# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Constants | Methods | Inherited Methods

# Log

`public final class Log`
`extends Object` ``

java.lang.Object
↳ | android.util.Log

API for sending log output.

Generally, you should use the `Log.v()`, `Log.d()`, `Log.i()`, `Log.w()`, and `Log.e()` methods to write logs. You can then view the logs in logcat.

The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE.

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

    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

    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.

## Summary

### Constants
`int` | `ASSERT` Priority constant for the println method.
`int` | `DEBUG` Priority constant for the println method; use Log.d.
`int` | `ERROR` Priority constant for the println method; use Log.e.
`int` | `INFO` Priority constant for the println method; use Log.i.
`int` | `VERBOSE` Priority constant for the println method; use Log.v.
`int` | `WARN` Priority constant for the println method; use Log.w.

### Public methods
`static int` | `d(String tag, String msg, Throwable tr)` Send a `DEBUG` log message and log the exception.
`static int` | `d(String tag, String msg)` Send a `DEBUG` log message.
`static int` | `e(String tag, String msg)` Send an `ERROR` log message.
`static int` | `e(String tag, String msg, Throwable tr)` Send a `ERROR` log message and log the exception.
`static String` | `getStackTraceString(Throwable tr)` Handy function to get a loggable stack trace from a Throwable
`static int` | `i(String tag, String msg, Throwable tr)` Send a `INFO` log message and log the exception.
`static int` | `i(String tag, String msg)` Send an `INFO` log message.
`static boolean` | `isLoggable(String tag, int level)` Checks to see whether or not a log for the specified tag is loggable at the specified level.
`static int` | `println(int priority, String tag, String msg)` Low-level logging call.
`static int` | `v(String tag, String msg)` Send a `VERBOSE` log message.
`static int` | `v(String tag, String msg, Throwable tr)` Send a `VERBOSE` log message and log the exception.
`static int` | `w(String tag, Throwable tr)` Send a `WARN` log message and log the exception.
`static int` | `w(String tag, String msg, Throwable tr)` Send a `WARN` log message and log the exception.
`static int` | `w(String tag, String msg)` Send a `WARN` log message.
`static int` | `wtf(String tag, String msg)` What a Terrible Failure: Report a condition that should never happen.
`static int` | `wtf(String tag, Throwable tr)` What a Terrible Failure: Report an exception that should never happen.
`static int` | `wtf(String tag, String msg, Throwable tr)` What a Terrible Failure: Report an exception that should never happen.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### ASSERT

    public static final int ASSERT

Priority constant for the println method.

Constant Value: 7 (0x00000007)

### DEBUG

    public static final int DEBUG

Priority constant for the println method; use Log.d.

Constant Value: 3 (0x00000003)

### ERROR

    public static final int ERROR

Priority constant for the println method; use Log.e.

Constant Value: 6 (0x00000006)

### INFO

    public static final int INFO

Priority constant for the println method; use Log.i.

Constant Value: 4 (0x00000004)

### VERBOSE

    public static final int VERBOSE

Priority constant for the println method; use Log.v.

Constant Value: 2 (0x00000002)

### WARN

    public static final int WARN

Priority constant for the println method; use Log.w.

Constant Value: 5 (0x00000005)

## Public methods

### d

    public static int d (String tag,
                    String msg,
                    Throwable tr)

Send a `DEBUG` log message and log the exception.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`int` |

### d

    public static int d (String tag,
                    String msg)

Send a `DEBUG` log message.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value cannot be `null`.

Returns
`int` |

### e

    public static int e (String tag,
                    String msg)

Send an `ERROR` log message.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value cannot be `null`.

Returns
`int` |

### e

    public static int e (String tag,
                    String msg,
                    Throwable tr)

Send a `ERROR` log message and log the exception.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`int` |

### getStackTraceString

    public static String getStackTraceString (Throwable tr)

Handy function to get a loggable stack trace from a Throwable

Parameters
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`String` | This value cannot be `null`.

### i

    public static int i (String tag,
                    String msg,
                    Throwable tr)

Send a `INFO` log message and log the exception.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`int` |

### i

    public static int i (String tag,
                    String msg)

Send an `INFO` log message.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value cannot be `null`.

Returns
`int` |

### isLoggable

    public static boolean isLoggable (String tag,
                    int level)

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.<YOUR_LOG_TAG> <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.<YOUR_LOG_TAG>=<LEVEL>' and place that in /data/local.prop.

Parameters
`tag` | `String`: The tag to check. This value may be `null`.
`level` | `int`: The level to check. Value is `ASSERT`, `ERROR`, `WARN`, `INFO`, `DEBUG`, or `VERBOSE`

Returns
`boolean` | Whether or not that this is allowed to be logged.

Throws
`IllegalArgumentException` | is thrown if the tag.length() > 23 for Nougat (7.0) and prior releases (API <= 25), there is no tag limit of concern after this API level.

### println

    public static int println (int priority,
                    String tag,
                    String msg)

Low-level logging call.

Parameters
`priority` | `int`: The priority/type of this log message Value is `ASSERT`, `ERROR`, `WARN`, `INFO`, `DEBUG`, or `VERBOSE`
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value cannot be `null`.

Returns
`int` | The number of bytes written.

### v

    public static int v (String tag,
                    String msg)

Send a `VERBOSE` log message.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value cannot be `null`.

Returns
`int` |

### v

    public static int v (String tag,
                    String msg,
                    Throwable tr)

Send a `VERBOSE` log message and log the exception.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`int` |

### w

    public static int w (String tag,
                    Throwable tr)

Send a `WARN` log message and log the exception.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`int` |

### w

    public static int w (String tag,
                    String msg,
                    Throwable tr)

Send a `WARN` log message and log the exception.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.
`tr` | `Throwable`: An exception to log This value may be `null`.

Returns
`int` |

### w

    public static int w (String tag,
                    String msg)

Send a `WARN` log message.

Parameters
`tag` | `String`: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. This value may be `null`.
`msg` | `String`: The message you would like logged. This value cannot be `null`.

Returns
`int` |

### wtf

    public static int wtf (String tag,
                    String msg)

What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack. Depending on system configuration, a report may be added to the `DropBoxManager` and/or the process may be terminated immediately with an error dialog.

Parameters
`tag` | `String`: Used to identify the source of a log message. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.

Returns
`int` |

### wtf

    public static int wtf (String tag,
                    Throwable tr)

What a Terrible Failure: Report an exception that should never happen. Similar to `wtf(java.lang.String, java.lang.String)`, with an exception to log.

Parameters
`tag` | `String`: Used to identify the source of a log message. This value may be `null`.
`tr` | `Throwable`: An exception to log. This value cannot be `null`.

Returns
`int` |

### wtf

    public static int wtf (String tag,
                    String msg,
                    Throwable tr)

What a Terrible Failure: Report an exception that should never happen. Similar to `wtf(java.lang.String, java.lang.Throwable)`, with a message as well.

Parameters
`tag` | `String`: Used to identify the source of a log message. This value may be `null`.
`msg` | `String`: The message you would like logged. This value may be `null`.
`tr` | `Throwable`: An exception to log. May be null. This value may be `null`.

Returns
`int` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*