## 4.2.15.9.2.2.4  Get Items from the Log
After an application log was read from the database, the items stored in the log must be accessed. To read one or more items from an application log, interface IF\_BALI\_LOG provides the following methods:
- GET\_ITEM: Read a single item from the application log.
- The item is identified by the Log Item Number which is a serial number containing the position of the item in the log.
- The method returns the reference to the item object.
- GET\_ALL\_ITEMS: Read all items from the application log.
- The method returns an internal table with the following structure:
- The Log Item Number of the item
- The reference to the item object
The item object contains all attributes of the item, for example the severity. Each item object uses interface IF\_BALI\_ITEM\_GETTER .
Public attributes of all log items:
- CATEGORY: Identifies the category of the item (see below).
- LOG\_ITEM\_NUMBER: The log item number which is the position of the item in the log.
- SEVERITY: Severity, such as 'Error', 'Warning', 'Information'. Possible values of the severity are defined as constants in interface IF\_BALI\_CONSTANTS .
- DETAIL\_LEVEL: If the application outputs the items of the application log, the detail level can be used to define at which level of detail the item shall be visible.
- TIMESTAMP: A UTC timestamp which contains the creation time of the item.
- CONTEXT\_STRUCTURE\_NAME: The name of the dictionary structure which was used to set the context. See Get the Context [page 1444].
## Methods of all log items:
- GET\_MESSAGE\_TEXT: It returns the message text of the item. It is:
- The output of ABAP command MESSAGE for a message item
- The text of a free text item
- The output of method GET\_TEXT of the exception object for an exception item
- GET\_CONTEXT: Get the context of the item. See Get the Context [page 1444].
The category of the item restricts which other attributes of the item are available. For example, the message number is only available for a message, because a free text does not have a message number. To get additional attributes, a down cast to the more specific interface of the item category is required. The following item categories are supported:
## · Message
- Attribute CATEGORY contains the value IF\_BALI\_CONSTANTS=&gt;C\_CATEGORY\_MESSAGE .
- Interface of a message is IF\_BALI\_MESSAGE\_GETTER .
For more information, see Get a Message [page 1443].
## · Free Text
- Attribute CATEGORY contains the value IF\_BALI\_CONSTANTS=&gt;C\_CATEGORY\_FREE\_TEXT.
- Interface of a free text is IF\_BALI\_FREE\_TEXT\_GETTER.
For more information, see Get a Free Text [page 1442].
## · Exception
- Attribute CATEGORY contains the value IF\_BALI\_CONSTANTS=&gt;C\_CATEGORY\_EXCEPTION.
- Interface of an exception is IF\_BALI\_EXCEPTION\_GETTER.
For more information, see Get an Exception [page 1443].
<!-- image -->
```
out->write( |{ l_item_entry-log_item_number } { l_item_entry-item->get_message_text( ) }| ). IF l_item_entry-item->category = if_bali_constants=>c_category_message. DATA(l_message_ref) = CAST if_bali_message_getter( l_item_entry-item ). out->write( |{ l_message_ref->id } { l_message_ref->number }| ). ELSEIF l_item_entry-item->category = if_bali_constants=>c_category_exception. DATA(l_exception_ref) = CAST if_bali_exception_getter( l_item_entry-item ). out->write( |{ l_exception_ref->exception_class } { l_exception_ref->exception_id_name }| ). ENDIF. ENDLOOP. CATCH cx_bali_runtime INTO DATA(l_exception). out->write( l_exception->get_text(  ) ). ENDTRY. ...
```