├── .abapgit.xml ├── .gitattributes ├── .travis.yml ├── LICENSE ├── README.md ├── abapdoc ├── remove_footer.ps1 ├── remove_footer.sh └── zalog │ ├── classes │ ├── zcl_alog_adt_logger.html │ ├── zcl_alog_bal_logger.html │ ├── zcl_alog_dbtab_logger.html │ ├── zcl_alog_dummy_logger.html │ ├── zcl_alog_entry_type.html │ ├── zcl_alog_file_logger.html │ ├── zcl_alog_itab_logger.html │ ├── zcl_alog_logger_base.html │ ├── zcl_alog_message_logger.html │ ├── zcl_alog_msg_logger_base.html │ ├── zcl_alog_progress_rep_logger.html │ ├── zcl_alog_static_configuration.html │ ├── zcl_alog_static_logger.html │ ├── zcl_alog_version.html │ ├── zcx_alog_already_attached.html │ ├── zcx_alog_argument_null.html │ ├── zcx_alog_bal_error.html │ ├── zcx_alog_illegal_argument.html │ ├── zcx_alog_logging_failed.html │ ├── zcx_alog_not_attached.html │ ├── zcx_alog_unsupported_msgty.html │ └── zcx_alog_unsupported_operation.html │ ├── interfaces │ ├── zif_alog_attachable.html │ ├── zif_alog_logger.html │ └── zif_alog_msg_logger.html │ ├── zalog_example │ └── classes │ │ ├── zcl_alog_example_adt_classrun.html │ │ └── zcl_alog_example_adt_classrun2.html │ └── zalog_test │ └── classes │ └── ztcl_alog_test_utl.html ├── abaplint.json ├── package.json ├── src ├── example │ ├── package.devc.xml │ ├── zalog_dbl.nrob.xml │ ├── zalog_example_bal_logger.prog.abap │ ├── zalog_example_bal_logger.prog.xml │ ├── zalog_example_dbtab_logger.prog.abap │ ├── zalog_example_dbtab_logger.prog.xml │ ├── zalog_example_file_logger.prog.abap │ ├── zalog_example_file_logger.prog.xml │ ├── zalog_example_itab_logger.prog.abap │ ├── zalog_example_itab_logger.prog.xml │ ├── zalog_example_message_logger.prog.abap │ ├── zalog_example_message_logger.prog.xml │ ├── zalog_example_prog_rep_logger.prog.abap │ ├── zalog_example_prog_rep_logger.prog.xml │ ├── zalog_example_static_logger.prog.abap │ ├── zalog_example_static_logger.prog.xml │ └── zalog_tadblogexa.tabl.xml ├── package.devc.xml ├── test │ ├── package.devc.xml │ ├── ztcl_alog_test_utl.clas.abap │ └── ztcl_alog_test_utl.clas.xml ├── zalog.msag.xml ├── zalog_debug_info.prog.abap ├── zalog_debug_info.prog.xml ├── zalog_l_entrytext.dtel.xml ├── zalog_l_type.dtel.xml ├── zalog_l_typedescr.dtel.xml ├── zalog_s_logentry.tabl.xml ├── zcl_alog_adt_logger.clas.abap ├── zcl_alog_adt_logger.clas.locals_def.abap ├── zcl_alog_adt_logger.clas.locals_imp.abap ├── zcl_alog_adt_logger.clas.xml ├── zcl_alog_bal_logger.clas.abap ├── zcl_alog_bal_logger.clas.testclasses.abap ├── zcl_alog_bal_logger.clas.xml ├── zcl_alog_dbtab_logger.clas.abap ├── zcl_alog_dbtab_logger.clas.testclasses.abap ├── zcl_alog_dbtab_logger.clas.xml ├── zcl_alog_dummy_logger.clas.abap ├── zcl_alog_dummy_logger.clas.xml ├── zcl_alog_entry_type.clas.abap ├── zcl_alog_entry_type.clas.xml ├── zcl_alog_file_logger.clas.abap ├── zcl_alog_file_logger.clas.testclasses.abap ├── zcl_alog_file_logger.clas.xml ├── zcl_alog_itab_logger.clas.abap ├── zcl_alog_itab_logger.clas.testclasses.abap ├── zcl_alog_itab_logger.clas.xml ├── zcl_alog_logger_base.clas.abap ├── zcl_alog_logger_base.clas.testclasses.abap ├── zcl_alog_logger_base.clas.xml ├── zcl_alog_message_logger.clas.abap ├── zcl_alog_message_logger.clas.xml ├── zcl_alog_msg_logger_base.clas.abap ├── zcl_alog_msg_logger_base.clas.xml ├── zcl_alog_progress_rep_logger.clas.abap ├── zcl_alog_progress_rep_logger.clas.xml ├── zcl_alog_static_configuration.clas.abap ├── zcl_alog_static_configuration.clas.xml ├── zcl_alog_static_logger.clas.abap ├── zcl_alog_static_logger.clas.locals_imp.abap ├── zcl_alog_static_logger.clas.xml ├── zcl_alog_version.clas.abap ├── zcl_alog_version.clas.testclasses.abap ├── zcl_alog_version.clas.xml ├── zcx_alog_already_attached.clas.abap ├── zcx_alog_already_attached.clas.xml ├── zcx_alog_argument_null.clas.abap ├── zcx_alog_argument_null.clas.xml ├── zcx_alog_bal_error.clas.abap ├── zcx_alog_bal_error.clas.xml ├── zcx_alog_illegal_argument.clas.abap ├── zcx_alog_illegal_argument.clas.xml ├── zcx_alog_logging_failed.clas.abap ├── zcx_alog_logging_failed.clas.xml ├── zcx_alog_not_attached.clas.abap ├── zcx_alog_not_attached.clas.xml ├── zcx_alog_unsupported_msgty.clas.abap ├── zcx_alog_unsupported_msgty.clas.xml ├── zcx_alog_unsupported_operation.clas.abap ├── zcx_alog_unsupported_operation.clas.xml ├── zif_alog_attachable.intf.abap ├── zif_alog_attachable.intf.xml ├── zif_alog_bapiret_logger.intf.abap ├── zif_alog_bapiret_logger.intf.xml ├── zif_alog_logger.intf.abap ├── zif_alog_logger.intf.xml ├── zif_alog_msg_logger.intf.abap └── zif_alog_msg_logger.intf.xml └── travis ├── deploy_abapdoc.sh └── ghpages.key.enc /.abapgit.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E 6 | /src/ 7 | PREFIX 8 | 9 | /.gitignore 10 | /LICENSE 11 | /README.md 12 | /package.json 13 | /.travis.yml 14 | /.gitattributes 15 | /abaplint.json 16 | /travis/* 17 | /abapdoc/* 18 | 19 | 20 | 21 | SAP_BASIS 22 | 740 23 | 24 | 25 | SAP_ABA 26 | 740 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | abapdoc/zalog/* linguist-documentation 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: "10" 3 | after_success: | 4 | test $TRAVIS_BRANCH = "master" && 5 | test $TRAVIS_PULL_REQUEST = "false" && 6 | chmod +x ./travis/deploy_abapdoc.sh && 7 | ./travis/deploy_abapdoc.sh 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Fabian Lupa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # abap-log [![Build Status](https://travis-ci.org/flaiker/abap-log.svg?branch=master)](https://travis-ci.org/flaiker/abap-log) [![ABAP Doc](https://img.shields.io/badge/ABAP%20Doc-latest-blue.svg)](https://flaiker.github.io/abap-log/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 2 | Logging library for ABAP 3 | 4 | ## Overview 5 | _abap-log_ is a library to provide various ways of logging messages in ABAP. The goal is to have a common interface for logger objects so that dependency injection can be used and logging-actions can be decoupled from application logic. Inline string log messages as well as message-class-based messages are supported. 6 | 7 | ### Supported targets 8 | - Internal table 9 | - Application log (BC-SRV-BAL) 10 | - `MESSAGE`-statements for batch processing (job log) 11 | - SAP GUI progress indicator 12 | - Custom database tables 13 | - Log text files on the application server 14 | - Eclipse console (using [IF_OO_ADT_CLASSRUN](https://help.sap.com/viewer/c238d694b825421f940829321ffa326a/7.51.1/en-US/520a4e84024b4a96b3793775bf9e6844.html)) 15 | 16 | ### Examples 17 | Example programs for each logger can be found in the package [ZALOG_EXAMPLE](https://github.com/flaiker/abap-log/tree/master/src/example). 18 | 19 | **Console logging in ABAP 7.51** 20 | 21 | 22 | **Internal table logging** 23 | ```abap 24 | REPORT zalog_example. 25 | 26 | DATA(go_logger) = NEW zcl_alog_itab_logger( ). 27 | 28 | go_logger->info( `Hello world.` ) ##NO_TEXT. 29 | go_logger->warning( `Hello darkness my old friend.` ) ##NO_TEXT. 30 | go_logger->error( `Ive come to talk with you again.` ) ##NO_TEXT. 31 | go_logger->debug( `BEEP BOOP` ) ##NO_TEXT. 32 | go_logger->exception( NEW zcx_alog_argument_null( ) ). 33 | 34 | MESSAGE s000(zalog) WITH 'Hello from message class' INTO DATA(gv_dummy) ##NEEDED ##NO_TEXT. 35 | go_logger->info_msg( ). 36 | 37 | go_logger->warning_msg( 38 | iv_msgid = 'ZALOG' 39 | iv_msgno = '001' 40 | iv_msgv1 = 'Hello from message class' 41 | iv_msgv2 = 'without where used list support...' 42 | ) ##NO_TEXT. 43 | 44 | TRY. 45 | go_logger->display_as_alv( ). 46 | CATCH cx_salv_msg INTO DATA(gx_ex). 47 | MESSAGE gx_ex TYPE 'E'. 48 | ENDTRY. 49 | ``` 50 | 51 | **Java style logging** 52 | ```abap 53 | CLASS lcl_class_with_logging DEFINITION. 54 | PUBLIC SECTION. 55 | CLASS-METHODS: 56 | class_constructor. 57 | METHODS: 58 | run. 59 | PRIVATE SECTION. 60 | CLASS-DATA: 61 | gi_logger TYPE REF TO zif_alog_logger. 62 | ENDCLASS. 63 | 64 | CLASS lcl_class_with_logging IMPLEMENTATION. 65 | METHOD class_constructor. 66 | DATA: lo_dummy TYPE REF TO lcl_class_with_logging ##NEEDED. 67 | gi_logger = zcl_alog_static_logger=>get_logger_for_any( lo_dummy ). 68 | ENDMETHOD. 69 | 70 | METHOD run. 71 | gi_logger->info( `Info message` ) ##NO_TEXT. 72 | gi_logger->warning( `WARNING` ) ##NO_TEXT. 73 | ENDMETHOD. 74 | ENDCLASS. 75 | ``` 76 | 77 | ### API and documentation 78 | Library documentation is done using ABAP Doc and can be found [here](https://flaiker.github.io/abap-log/) as deployed HTML. It can also be viewed in eclipse in the _ABAP Element Info_ view (F2). 79 | 80 | **Class diagram** 81 |
82 | 83 | 84 | ## Installation 85 | To use this library at least ABAP 740 must be supported by the application server. The reason for this is mostly the new syntax which is heavily used. 86 | - Clone the repository via [abapGit](https://github.com/larshp/abapGit) 87 | - Recommended target package: ZALOG 88 | 89 | ## Development 90 | Feel free to contribute using pull requests or issues for feature requests and bug reports. This project has been entirely developed in the ABAP Development Tools for eclipse, including ABAP Doc documentation (which is automatically deployed to GitHub pages) and class based exceptions (these cannot be fully edited in SE24 (!)). Using eclipse is therefore highly recommended. 91 | 92 | ## License 93 | [MIT License Copyright (c) 2017 Fabian Lupa](LICENSE) 94 | -------------------------------------------------------------------------------- /abapdoc/remove_footer.ps1: -------------------------------------------------------------------------------- 1 | # Remove generation date footer so it does not show up as a diff 2 | gci -Path ( split-path -parent $MyInvocation.MyCommand.Definition ) -Filter *.html -Recurse | 3 | %{ 4 | $c = ($_ | Get-Content) 5 | $c = $c -replace '',"" 6 | [IO.File]::WriteAllText($_.FullName, ($c -join "`r`n")) 7 | } 8 | -------------------------------------------------------------------------------- /abapdoc/remove_footer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Remove generation date footer so it does not show up as a diff 4 | for file in $(find $(dirname "$(readlink -f "$0")") -name '*.html'); 5 | do 6 | sed -E 's/