Skip to content

Most visited

Recently visited

navigation
Added in API level 8

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.

Hooray!

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.