[BUGFIX] CLI context cannot write to backend log

The CLI context cannot write to the backend log. The
log entry also has an information about the currently used
IP address, which is taken from the environment variable
REMOTE_ADDR. In a CLI disposal this value is NULL and cannot
be stored in the database, since the accordant sys_log.IP
field does not support NULL values.

Note: Already merged in master (6.2) with different subject:
[BUGFIX] Functional tests cannot write to backend log

Fixes: #54849
Releases: 6.2, 6.1, 6.0
Change-Id: If6c572c62ab7022a4cab596fa4660dec754aee3c
Reviewed-on: https://review.typo3.org/27023
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader