c - Where does linux store my syslog? -
i wrote simple test application log in log file. using linux mint , after application executes try view log using command:
tail -n 100 /var/log/messages
but file messages not exist neither tested or something. below can find code. maybe doing wrong, file isn't stored there or need enable logging in linux mint.
#include <stdio.h> #include <stdlib.h> #include <syslog.h> void init_log() { setlogmask(log_upto(log_notice)); openlog("testd",log_cons | log_pid | log_ndelay, log_local1); } int main(void) { init_log(); printf("session started!"); syslog(log_notice, "session started!!"); closelog(); return exit_success; }
on ubuntu machine, can see output @ /var/log/syslog
.
as noted others, syslog()
output logged /var/log/syslog
file.
can see system, user, , other logs @ /var/log
.
for more details: here's interesting link.
Comments
Post a Comment