简体   繁体   中英

Simultaneously write to multiple syslog facilities?

Is it possible to have one application simultaneously write to multiple syslog facilities?

I have an application, written in C/C++, that I would like to write some messages to local0 and other messages to local1. I do not want the messages for local0 to appear in local1 or vice versa.

Looking at the man page for syslog , I see the example:

syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");

Does

syslog(LOG_INFO|LOG_LOCAL0, "message for local0");
syslog(LOG_INFO|LOG_LOCAL1, "message for local1");

work?

You can't do it in a single call. You'll have to make a call for each facility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM