1PMOPENLOG(3)               Library Functions Manual               PMOPENLOG(3)
2
3
4

NAME

6       pmOpenLog - create a log file for diagnostics and debug output
7

C SYNOPSIS

9       #include <pcp/pmapi.h>
10
11       FILE *pmOpenLog(const char *progname, const char *logname,
12               FILE *oldstream, int *status);
13
14       cc ... -lpcp
15

DESCRIPTION

17       pmOpenLog reassigns the standard I/O stream oldstream (normally stderr)
18       to  be associated with the file logname.  If logname is not "-" and al‐
19       ready exists, it will be removed and recreated if possible  (to  ensure
20       correct ownership and permissions from the caller to pmOpenLog).
21
22       As  a  special  case, if logname is "-" then no removal or reopening is
23       performed and the function simply sets status to  1  and  returns  old‐
24       stream.   This is useful when the caller wants diagnostics on oldstream
25       stream (normally stderr) rather than a file, e.g.  pmlogger -l- or pmcd
26       -f  -l-.  Logging to stderr is also useful for PMDAs in a containerized
27       environment where it is beneficial for all PMDA logs to be  written  to
28       pmcd's  stderr  stream (and thus to a single destination), whether that
29       is a file such as pmcd.log or the original stream  inherited  from  the
30       shell.
31
32       On  return, the function value is the standard I/O stream, possibly re‐
33       placing oldstream.  In the event of an error, the return value will  be
34       oldstream unchanged and status will be 0.
35
36       For success, status is 1, and a standard preamble is written to logname
37            Log for progname on hostname started date and time
38       and  an  atexit(3) handler is installed to write the postscript message
39       to logname
40            Log finished date and time
41       when the processes exits.
42
43       progname is only used to annotate messages.
44

SEE ALSO

46       atexit(3) and freopen(3).
47
48
49
50Performance Co-Pilot                  PCP                         PMOPENLOG(3)
Impressum