You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This logger dynamically uses the <em>OUT</em>-parameter of <em>IF_OO_ADT_CLASSRUN~MAIN</em> for
4
+
log output. Static usage is intentionally avoided because the interface is only available as of
5
+
ABAP 7.51.
6
+
</p>
7
+
Unfortunately there are some limitations if you expect Java-style console output. These seem to
8
+
be 'by design':
9
+
<ul>
10
+
<li>Logged output is only transmitted after the <em>main</em>-method has finished
11
+
execution</li>
12
+
<li>Logged output is not transmitted at all if the application fails with a short dump</li>
13
+
<li>Log entries are always separated by an empty line</li>
14
+
</ul></span><h4id="attributes">Attributes</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>private instance</td><td><spanclass="identifier fieldName">mi_console_adapter</span> type ref to LCL_ADAPTER </td><td> </td></tr></table><h4id="methods">Methods</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>public instance</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">constructor</span></td></tr><tr><td>importing</td><td><spanclass="identifier parameterName">io_out</span></td><td>type ref to OBJECT</td></tr><tr><td>raising</td><tdcolspan="2"><spanclass="identifier exceptionName">zcx_alog_argument_null</span></td></tr><tr><td>raising</td><tdcolspan="2"><spanclass="identifier exceptionName">zcx_alog_illegal_argument</span></td></tr></table></td><td><spanclass="abapDocComment"></span><h5>Parameters</h5><tableclass="methodParametersDocumentation"><tr><td><spanclass="identifier parameterName">io_out</span></td><td><spanclass="abapDocComment"> Reference to <em>IF_OO_ADT_INTRNL_CLASSRUN</em> as found in
15
+
<em>IF_OO_ADT_CLASSRUN~MAIN</em>-OUT
16
+
</span></td></tr></table><h5>Class-based Exceptions</h5><tableclass="exceptions"><tr><td><spanclass="identifier exceptionName">zcx_alog_argument_null</span></td><td><spanclass="abapDocComment"><em>io_out</em> cannot be null
17
+
</span></td></tr><tr><td><spanclass="identifier exceptionName">zcx_alog_illegal_argument</span></td><td><spanclass="abapDocComment"><em>io_out</em> does not implement
Allow logging to a file on the application server. The file handle will be opened and closed
4
+
for each logged message. The file will be created if it does not exist. If it does exists the new
5
+
entries will be appended. Logical paths are supported.
6
+
</p></span><h4id="attributes">Attributes</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>private instance</td><td><spanclass="identifier fieldName">mv_path</span> type STRING </td><td> </td></tr></table><h4id="methods">Methods</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>public static</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">from_logical_path</span></td></tr><tr><td>importing</td><td><spanclass="identifier parameterName">iv_logpath</span></td><td>type PATHINTERN</td></tr><tr><td></td><td><spanclass="identifier parameterName">iv_filename</span></td><td>type STRING</td></tr><tr><td>returning</td><td>value(<spanclass="identifier parameterName">ro_logger</span>)</td><td>type ref to ZCL_ALOG_FILE_LOGGER</td></tr><tr><td>raising</td><tdcolspan="2"><spanclass="identifier exceptionName">zcx_alog_illegal_argument</span></td></tr></table></td><td><spanclass="abapDocComment"> Get an instance using a logical path
7
+
</span><h5>Parameters</h5><tableclass="methodParametersDocumentation"><tr><td><spanclass="identifier parameterName">iv_logpath</span></td><td><spanclass="abapDocComment"> Logical path name
8
+
</span></td></tr><tr><td><spanclass="identifier parameterName">iv_filename</span></td><td><spanclass="abapDocComment"> File name
</span></td></tr></table><h5>Class-based Exceptions</h5><tableclass="exceptions"><tr><td><spanclass="identifier exceptionName">zcx_alog_illegal_argument</span></td><td><spanclass="abapDocComment"> Logical path cannot be used</span></td></tr></table></td></tr><tr><td>public instance</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">constructor</span></td></tr><tr><td>importing</td><td><spanclass="identifier parameterName">iv_path</span></td><td>type CSEQUENCE</td></tr></table></td><td><spanclass="abapDocComment"></span><h5>Parameters</h5><tableclass="methodParametersDocumentation"><tr><td><spanclass="identifier parameterName">iv_path</span></td><td><spanclass="abapDocComment"> Physical file path on application server</span></td></tr></table></td></tr><tr><td>protected instance</td><td><spanclass="identifier methodName">entry_internal</span> redefinition</td><td> </td></tr><tr><td>protected instance</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">get_formatted_text</span></td></tr><tr><td>importing</td><td><spanclass="identifier parameterName">iv_text</span></td><td>type CSEQUENCE</td></tr><tr><td></td><td><spanclass="identifier parameterName">io_type</span></td><td>type ref to ZCL_ALOG_ENTRY_TYPE</td></tr><tr><td>returning</td><td>value(<spanclass="identifier parameterName">rv_formatted_text</span>)</td><td>type STRING</td></tr></table></td><td><spanclass="abapDocComment"> Get a formatted log message
11
+
<p>
12
+
Override this method in a subclass for custom formatting.
13
+
</p>
14
+
</span><h5>Parameters</h5><tableclass="methodParametersDocumentation"><tr><td><spanclass="identifier parameterName">iv_text</span></td><td><spanclass="abapDocComment"> Message text
15
+
</span></td></tr><tr><td><spanclass="identifier parameterName">io_type</span></td><td><spanclass="abapDocComment"> Message type
<!DOCTYPE html><html><head><metahttp-equiv="content-type" content="text/html; charset=utf-8"><title>Class ZCL_ALOG_LOGGER_BASE</title><linkrel="stylesheet" href="../../../htmldesign/stylesheet.css" type="text/css"></head><body><divid="header"><divid="navigationMenu"><ahref="#interfaces">Interfaces</a> | <ahref="#attributes">Attributes</a> | <ahref="#methods">Methods</a></div></div><divid="content"><h2>Class <spanclass="identifier objectName">ZCL_ALOG_LOGGER_BASE</span></h2><p>public abstract create public</p><h4>Documentation</h4><spanclass="abapDocComment"> Logger base class
2
2
<p>
3
3
Inherit from this class and implement <em>entry_internal</em> for the logging logic.
4
-
</p></span><h4id="interfaces">Interfaces</h4><spanclass="identifier interfaceName">zif_alog_attachable</span><br/><spanclass="identifier interfaceName">zif_alog_logger</span> final methods ENTRY<br/><h4id="aliases">Aliases</h4><table><thead><tr><th>Visibility and Level</th><th>Alias</th><th>Component</th></tr></thead><tr><td>public</td><td><strong>attach</strong></td><td>ZIF_ALOG_ATTACHABLE~ATTACH</td></tr><tr><td>public</td><td><strong>debug</strong></td><td>ZIF_ALOG_LOGGER~DEBUG</td></tr><tr><td>public</td><td><strong>detach</strong></td><td>ZIF_ALOG_ATTACHABLE~DETACH</td></tr><tr><td>public</td><td><strong>entry</strong></td><td>ZIF_ALOG_LOGGER~ENTRY</td></tr><tr><td>public</td><td><strong>error</strong></td><td>ZIF_ALOG_LOGGER~ERROR</td></tr><tr><td>public</td><td><strong>exception</strong></td><td>ZIF_ALOG_LOGGER~EXCEPTION</td></tr><tr><td>public</td><td><strong>info</strong></td><td>ZIF_ALOG_LOGGER~INFO</td></tr><tr><td>public</td><td><strong>warning</strong></td><td>ZIF_ALOG_LOGGER~WARNING</td></tr></table><h4id="attributes">Attributes</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>protected instance</td><td><spanclass="identifier fieldName">mt_attached_loggers</span> TYPE HASHED TABLE OF REF TO zif_alog_logger WITH UNIQUE KEY table_line </td><td> </td></tr><tr><td>private instance</td><td><spanclass="identifier fieldName">mo_minimal_log_level</span> type ref to ZCL_ALOG_ENTRY_TYPE </td><td> </td></tr></table><h4id="methods">Methods</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>public instance</td><td><spanclass="identifier methodName">constructor</span></td><td> </td></tr><tr><td>public instance</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">get_minimal_log_level</span></td></tr><tr><td>returning</td><td>value(<spanclass="identifier parameterName">ro_type</span>)</td><td>type ref to ZCL_ALOG_ENTRY_TYPE</td></tr></table></td><td><spanclass="abapDocComment"> Gets the minimal log level
4
+
</p></span><h4id="interfaces">Interfaces</h4><spanclass="identifier interfaceName">zif_alog_attachable</span><br/><spanclass="identifier interfaceName">zif_alog_logger</span> final methods ENTRY<br/><h4id="attributes">Attributes</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>protected instance</td><td><spanclass="identifier fieldName">mt_attached_loggers</span> TYPE HASHED TABLE OF REF TO zif_alog_logger WITH UNIQUE KEY table_line </td><td> </td></tr><tr><td>private instance</td><td><spanclass="identifier fieldName">mo_minimal_log_level</span> type ref to ZCL_ALOG_ENTRY_TYPE </td><td> </td></tr></table><h4id="methods">Methods</h4><table><thead><tr><th>Visibility and Level</th><th>Name</th><th>Documentation</th></tr></thead><tr><td>public instance</td><td><spanclass="identifier methodName">constructor</span></td><td> </td></tr><tr><td>public instance</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">get_minimal_log_level</span></td></tr><tr><td>returning</td><td>value(<spanclass="identifier parameterName">ro_type</span>)</td><td>type ref to ZCL_ALOG_ENTRY_TYPE</td></tr></table></td><td><spanclass="abapDocComment"> Gets the minimal log level
5
5
</span><h5>Parameters</h5><tableclass="methodParametersDocumentation"><tr><td><spanclass="identifier parameterName">ro_type</span></td><td><spanclass="abapDocComment"> Entry type with the current minimal priority</span></td></tr></table></td></tr><tr><td>public instance</td><td><tableclass="methodSignature"><tr><tdcolspan="3"><spanclass="identifier methodName">set_minimal_log_level</span></td></tr><tr><td>importing</td><td><spanclass="identifier parameterName">io_type</span></td><td>type ref to ZCL_ALOG_ENTRY_TYPE</td></tr><tr><td>raising</td><tdcolspan="2"><spanclass="identifier exceptionName">zcx_alog_argument_null</span></td></tr></table></td><td><spanclass="abapDocComment"> Sets the minimal log level
6
6
<p>
7
7
If a new log entry's entry type does not have at least the priority of the entry type set
0 commit comments