to top
Android APIs
public class

EventLog

extends Object
java.lang.Object
   ↳ android.util.EventLog

Class Overview

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, Object... list)
Record an event log message.
static int writeEvent(int tag, long value)
Record an event log message.
static int writeEvent(int tag, String str)
Record an event log message.
static int writeEvent(int tag, int value)
Record an event log message.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static int getTagCode (String name)

Added in API level 8

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

Parameters
name of event to look up
Returns
  • the tag code, or -1 if no tag has that name

public static String getTagName (int tag)

Added in API level 8

Get the name associated with an event type tag code.

Parameters
tag code to look up
Returns
  • the name of the tag, or null if no tag has that number

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

Added in API level 8

Read events from the log, filtered by type.

Parameters
tags to search for
output container to add events into
Throws
IOException if something goes wrong reading events

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

Added in API level 8

Record an event log message.

Parameters
tag The event type tag code
list A list of values to log
Returns
  • The number of bytes written

public static int writeEvent (int tag, long value)

Added in API level 8

Record an event log message.

Parameters
tag The event type tag code
value A value to log
Returns
  • The number of bytes written

public static int writeEvent (int tag, String str)

Added in API level 8

Record an event log message.

Parameters
tag The event type tag code
str A value to log
Returns
  • The number of bytes written

public static int writeEvent (int tag, int value)

Added in API level 8

Record an event log message.

Parameters
tag The event type tag code
value A value to log
Returns
  • The number of bytes written