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, int value)

Record an event log message.

static int writeEvent(int tag, float value)

Record an event log message.

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

Record an event log message.

static int writeEvent(int tag, long value)

Record an event log message.

Inherited methods

Public methods

getTagCode

Added in API level 8
public static 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
public static 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
public static 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
public static 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
public static 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
public static 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
public static 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
public static 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