How do I find my program name?

元气小坏坏 提交于 2019-12-23 18:13:58

问题


Problem

I am unable to write to a different log than the default one using syslog. I am unsure if maybe my app name is wrong in my configuration. Do "program name" and "process name" not mean the same thing? If not, how can I find my program name in Python 3.6?

Attempted

I have written a small application in Python 3.6. I am already successfully writing to a common syslog file in CentOS 7 at /var/log/messages with it. If I open that file, I can see my entries.

If I run ps aux | grep myappname, the process name is listed as python myappname.py.

I have created a file at /etc/rsyslog.d/00-myconfig.conf which contents are:

if $programname contains 'myappname' then /home/user/test_log.log
& ~

I have restarted the process with sudo systemctl restart rsyslog.

I have run rsyslogd -N1 which gives me a deprecation warning about my use of ~ in my config, proving that the config is being recognized. I have tried removing that line as I am not sure what it does, but that does not help either.

I can confirm that the entries are still being written to /var/log/messages. The entries are not going up in smoke.

来源:https://stackoverflow.com/questions/45722547/how-do-i-find-my-program-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!