Hello,
I have a Python script that writes messages to syslog.
The script works with the print and sleep commands. When I remove the
print and sleep commands, only the first two commands appear in
local5.log file.
=====
#!/usr/bin/env python3.14
import syslog
import os
import sys
import time
FACILITY = syslog.LOG_LOCAL5
def _get_script_name():
return os.path.basename(sys.argv[0])
def LOG_E(message):
script_name = _get_script_name()
formatted_message = f"ERROR: {script_name} {message}"
syslog.openlog(
ident=script_name,
logoption=syslog.LOG_PID,
facility=FACILITY
)
syslog.syslog(syslog.LOG_INFO, formatted_message)
syslog.closelog()
LOG_E("test_e13aaa")
# print("test_e13")
# time.sleep(1)
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 59 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 03:56:27 |
| Calls: | 810 |
| Files: | 1,287 |
| D/L today: |
4 files (10,048K bytes) |
| Messages: | 203,128 |