Skip to content

Most visited

Recently visited

navigation

EventLog

public class EventLog
extends Object

java.lang.Object
   ↳ android.util.EventLog


Access to the system diagnostic event record. System diagnostic events are used to record certain system-level events (such as garbage collection, activity manager state, system watchdogs, and other low level activity), which may be automatically collected and analyzed during system development.

This is not the main "logcat" debugging log (Log)! These diagnostic events are for system integrators, not application authors.

Events use integer tag codes corresponding to /system/etc/event-log-tags. They carry a payload of one or more int, long, or String values. The event-log-tags file defines the payload contents for each type code.

Summary

Nested classes

class EventLog.Event

A previously logged event read from the logs. 

Public methods

static int getTagCode(String name)

Get the event type tag code associated with an event name.

static String getTagName(int tag)

Get the name associated with an event type tag code.

static void readEvents(int[] tags, Collection<EventLog.Event> output)

Read events from the log, filtered by type.

static int writeEvent(int tag, String str)

Record an event log message.

static int writeEvent(int tag, Object... list)

Record an event log message.

static int writeEvent(int tag, int value)

Record an event log message.

static int writeEvent(int tag, float value)

Record an event log message.

static int writeEvent(int tag, long value)

Record an event log message.

Inherited methods

From class java.lang.Object

Public methods

getTagCode

added in API level 8
int getTagCode (String name)

Get the event type tag code associated with an event name.

Parameters
name String: of event to look up

Returns
int the tag code, or -1 if no tag has that name

getTagName

added in API level 8
String getTagName (int tag)

Get the name associated with an event type tag code.

Parameters
tag int: code to look up

Returns
String the name of the tag, or null if no tag has that number

readEvents

added in API level 8
void readEvents (int[] tags, 
                Collection<EventLog.Event> output)

Read events from the log, filtered by type.

Parameters
tags int: to search for

output Collection: container to add events into

Throws
IOException if something goes wrong reading events

writeEvent

added in API level 8
int writeEvent (int tag, 
                String str)

Record an event log message.

Parameters
tag int: The event type tag code

str String: A value to log

Returns
int The number of bytes written

writeEvent

added in API level 8
int writeEvent (int tag, 
                Object... list)

Record an event log message.

Parameters
tag int: The event type tag code

list Object: A list of values to log

Returns
int The number of bytes written

writeEvent

added in API level 8
int writeEvent (int tag, 
                int value)

Record an event log message.

Parameters
tag int: The event type tag code

value int: A value to log

Returns
int The number of bytes written

writeEvent

added in API level 23
int writeEvent (int tag, 
                float value)

Record an event log message.

Parameters
tag int: The event type tag code

value float: A value to log

Returns
int The number of bytes written

writeEvent

added in API level 8
int writeEvent (int tag, 
                long value)

Record an event log message.

Parameters
tag int: The event type tag code

value long: A value to log

Returns
int The number of bytes written

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.