Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *** Neuen Anwendungsprotokoll erstellen
- "https://wiki.m1ch3l.de/Anwendungsprotokoll_in_Cloud_Entwicklung_erstellen#Neuen_Anwendungsprotokoll_erstellen
- TRY.
- DATA(lo_log) = cl_bali_log=>create( ).
- CATCH cx_bali_runtime INTO DATA(lx_runtime_exception).
- ENDTRY.
- lo_log->set_header( header = cl_bali_header_setter=>create( object = 'YOBJECT'
- subobject = 'YSUBOBJECT'
- external_id = 'Ext ID' ) ).
- *** Nachrichten zum Anwendungsprotokoll hinzufügen
- TRY.
- DATA(lo_message) = cl_bali_message_setter=>create( severity = if_bali_constants=>c_severity_error
- id = 'YMC_ABC'
- number = '000' ).
- lo_log->add_item( item = lo_message ).
- lo_log->add_item( item = cl_bali_message_setter=>create_from_sy( ) ).
- DATA(lo_free_text) = cl_bali_free_text_setter=>create( severity = if_bali_constants=>c_severity_error
- text = 'Some Error Text' ).
- lo_log->add_item( item = l_free_text ).
- DATA(lo_exception) = cl_bali_exception_setter=>create( severity = if_bali_constants=>c_severity_error
- exception = lo_ref ).
- lo_log->add_item( item = l_exception ).
- CATCH cx_bali_runtime INTO DATA(lx_runtime_exception).
- ENDTRY.
- *** Anwendungsprotokoll auf die Datenbank speichern
- "Es gibt zwei Methoden zum Speichern des Logs:
- "SAVE_LOG: verwendet die Standarddatenbankverbindung. Dies bedeutet, dass das Protokoll nur dann auf die Datenbank geschrieben wird, wenn "die Anwendung COMMIT_WORK aufruft.
- "SAVE_LOG_2ND_DB_CONNECTION: verwendet zum Speichern ein Service, der das Protokoll direkt auf die Datenbank commited
- TRY.
- cl_bali_log_db=>get_instance( )->save_log( log = lo_log ).
- cl_bali_log_db=>get_instance( )->save_log_2nd_db_connection( log = lo_log ).
- CATCH cx_bali_runtime INTO DATA(lx_runtime_exception).
- ENDTRY.
- *** Anwendungsprotokoll aus dem Speicher löschen / Prüfung Speicher gelöscht
- TRY.
- lo_log->release_memory( ).
- IF lo_log->is_invalidated( ).
- ENDIF
- CATCH cx_bali_runtime INTO DATA(lx_runtime_exception).
- lo_runtime_exception->get_text( ).
- ENDTRY.
- *** Anwendungsprotokoll löschen
- TRY.
- cl_bali_log_db=>get_instance( )->delete_log( log = l_log ).
- CATCH cx_bali_runtime INTO DATA(lx_runtime_exception).
- ENDTRY.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement