Description

When calling inline functions using app_python3s_exec(), setting the level to critical using either KSR.xlog.xcrit("foo\n") or using KSR.xlog.xlog("L_CRIT", "foo\n") Do not set the level on the log line in a manner consistent with other log levels.

Reproduction

Kamailio code:

request_route {
    app_python3s_exec("log_test");
    . . .
}

Python code to contrast how info level logging and critical level logging differ:

def log_test():
    KSR.xlog.xinfo("This line log level: xinfo = INFO\n");
    KSR.xlog.xcrit("This line log level: xcrit = CRITICAL\n");
    KSR.xlog.xlog("L_INFO", "This line log level: xlog = L_INFO\n");
    KSR.xlog.xlog("L_CRIT", "This line log level: xlog =  L_CRIT\n");

Log Messages

Log output. Note how the info level lines begin with INFO, but the critical level lines begin with an empty string:

2(8) INFO: <script>: This line log level: xinfo = INFO
2(8) : <script>: This line log level: xcrit = CRITICAL
2(8) INFO: <script>: This line log level: xlog = L_INFO
2(8) : <script>: This line log level: xlog =  L_CRIT

Possible Solutions

The critical level lines should begin with CRITICAL - this is what happens if the xlog function is called in Kamailio script. The output should look like this:

2(8) INFO: <script>: This line log level: xinfo = INFO
2(8) CRITICAL: <script>: This line log level: xcrit = CRITICAL
2(8) INFO: <script>: This line log level: xlog = L_INFO
2(8) CRITICAL: <script>: This line log level: xlog =  L_CRIT

Additional Information

version: kamailio 5.8.4 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled on 15:03:24 Nov 18 2024 with gcc 13.2.1
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.20.2
PRETTY_NAME="Alpine Linux v3.20"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/4048@github.com>