Programming with Rsyslog, generating trace information, logging into logs

Source: Internet
Author: User
Tags syslog rsyslog

Reference: http://blog.csdn.net/nowayings/article/details/38926501

Https://www.cnblogs.com/bonelee/p/6234647.html

Print to the log:

The code is as follows

#include <syslog.h><stdio.h>int  main () {        FILE*F;         = fopen ("ABC","R");         if (! f) {                syslog (log_err| Log_user,"test-%m/n");}        }

The configuration is as follows: Add the 2nd line section.

[Email protected]:~/workspace/log$ vim/etc/rsyslog.d/30-debug.conf

*.debug         /var/log/mydebug.loguser. *          -/var/log/"logger" ~

To run the code:

[Email protected]:~/workspace/log$./a.out

Cat  /var/log/: $file or directory/  from:£ º or directory/n



Programming with Rsyslog, generating trace information, logging into logs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.