日志信息log

news/2025/2/23 22:13:02
#include<syslog.h>
//建立一个到系统日志的连接
//ident参数指向字符串,syslog()输出的每条信息都会包含这个字符串,这个参数的取值通常是程序名
//log_options参数是一个位掩码
//LOG_CONS  当向系统日志发送信息发生错误时将信息写入到系统控制台
//LOG_NDELAY    立即打开到日志系统的连接
//LOG_NOWAIT    不要wait()被创建来记录日志消息的子进程
//LOG_ODELAY    连接到日志系统的操作会被延迟至记录第一条信息时
//LOG_PERROR    将消息写入标准错误和系统日志  
//LOG_PID   在每条消息中加上调用者的进程id
void openlog(const char *ident,int log_options,int facility);

这里写图片描述


//写入一条日志信息
void syslog(int priority,const char *format,...);
]这里写图片描述

//看一下openlog()和syslog()用法例子
openlog(argv[0],LOG_PID|LOG_CONS|LOG_NOWAIT,LOG_LOCALO);
syslog(LOG_ERROR,"bad argument:%s",argv[1]);

//关闭日志
void closelog(void);

//过滤有syslog()写入的信息的掩码
int setlogmask(int mask_priority);

转载于:https://www.cnblogs.com/biaopei/p/7730603.html


http://www.niftyadmin.cn/n/711139.html

相关文章

mmm hardware/libhardware_legacy/power/

android源码目录下的build/envsetup.sh文件&#xff0c;描述编译的命令 - m: Makes from the top of the tree. - mm: Builds all of the modules in the current directory. - mmm: Builds all of the modules in the supplied directories. 要想使用这些命…

关于form表单回车自动刷新

现象&#xff1a; form表单&#xff0c;输入框聚焦后&#xff0c;回车&#xff0c;页面刷新跳转。 原因&#xff1a; form表单&#xff0c;在只有一个输入框的时候&#xff0c;在点击回车时&#xff0c;就会触发表单的提交&#xff0c;而form若没有url&#xff0c;则提交后就会…

Java8新特性——新一套日期时间API

文章目录&#xff1a; 1.新旧对比&#xff08;线程安全问题&#xff09; 2.LocalDate 3.LocalTime 4.LocalDateTime 5.Instant 6.Duration、Period 7.TestTemporalAdjuster、TestTemporalAdjusters 8.DateTimeFormatter 1.新旧对比&#xff08;线程安全问题&#xff09…

Request.InputStream 将数据作为XML数据发送

将数据作为XML数据发送,例如: public voidPostXml(stringurl, stringxml){ byte[] bytes Encoding.UTF8.GetBytes(xml); HttpWebRequest request (HttpWebRequest) WebRequest.Create(url); request.Method "POST"; request.ContentLength bytes.Len…

oauth2学习

oauth2 生词&#xff1a; 授权码模式&#xff08;authorization code&#xff09;简化模式&#xff08;implicit&#xff09;密码模式&#xff08;resource owner password credentials&#xff09;客户端模式&#xff08;client credentials&#xff09;问题&#xff1a; 分享…

AndroidImagePicker 的使用

github地址 https://github.com/easonline/AndroidImagePicker 效果图 本文转自Work Hard Work Smart博客园博客&#xff0c;原文链接&#xff1a;http://www.cnblogs.com/linlf03/p/5235541.html&#xff0c;如需转载请自行联系原作者

SpringBoot——四大核心之指标监控(actuator)

1.写在前面 首先肯定要说一下SpringBoot的四大核心了&#xff1a; 自动装配&#xff1a;简单配置甚至零配置即可运行项目起步依赖&#xff1a;场景启动器Actuator&#xff1a;指标监控命令行界面 &#xff1a;命令行这篇文章呢&#xff0c;我来和大家聊聊指标监控这个东西。 2.…

[Google] 出现次数最多的前K个元素

bob, joe, bob, jane, bob, joe, jack bob 3 joe 2 topN(2) bob, joe . interface TopN {void insert(String query);List<String> getTop(int n); } 用map<string, int>来存string在数组v中的下标&#xff0c;v存包含string与出现次数cnt的结构体&#xff0c;每…