Back to home page

Enduro/X

 
 

    


0001 TPLOGSETREQFILE(3)
0002 ==================
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 tplogsetreqfile - Set request logging file
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 #include <atmi.h>
0014 
0015 int tplogsetreqfile(char **'data', char *'filename', char *'filesvc');
0016 
0017 
0018 For XATMI client link with '-latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm'
0019 
0020 For XATMI server link with '-latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm'
0021 
0022 DESCRIPTION
0023 -----------
0024 Function enables request logging with advanced configuration. With this function 
0025 you may do following:
0026 
0027 - Take the log file name from UBF buffer (sent in 'data' field) and use it as 
0028 request logging facility output;
0029 
0030 - Initialize the UBF buffer with request logging field name from 'filename' 
0031 parameter and user 'filename' as output for logging;
0032 
0033 - If field is not present in 'data' and not present in 'filename', then call 
0034 'filesvc' (if set, not NULL and not EOS), XATMI service  with 'data' buffer, 
0035 receive the value in UBF buffer and use it as logging output. It is assumed that 
0036 target 'filesvc' service will call this function on incoming buffer with 
0037 'filename' set. So basically concept is that you may develop in system
0038 special XATMI server which classify the incoming requests and assigns 
0039 them corresponding request logging files.
0040 
0041 
0042 All function parameters are conditional. If every field will be NULL or EOS, 
0043 then function will return error. The order 
0044 of the parameter usage is following:
0045 
0046 1. If 'data' is present and it is UBF buffer, then it tries to use field 
0047 name from UBF buffer (field *EX_NREQLOGFILE*);
0048 
0049 2. If EX_NREQLOGFILE is not in the UBF buffer, then use 'filename';
0050 
0051 3. If 'filename' is not set, then try to invoke 'filesvc';
0052 
0053 4. If 'filesvc' is not set, then fail with error;
0054 
0055 5. If 'data' is not UBF, then try to setup from filename;
0056 
0057 6. If 'data' buffer is not present, then try to setup from 'filename';
0058 
0059 7. If 'filename' is not set, then fail with error.
0060 
0061 
0062 Function applies to all Enduro/X logging facilities: *TP*, *NDRX* and *UBF*.
0063 
0064 Special care shall be taken when working in multi-threaded environment (this
0065 includes single thread apps running built in Enduro/X 'emq', 'poll' and 'SystemV'
0066 modes where auxiliary threads are used. In mulit-threaded mode, the output
0067 file name shall differ for process logging file name. Otherwise the output file
0068 pointer is re-used from process logger. Thus If other thread changes process
0069 loggers, this process request logger file pointer might become broken (and
0070 thus cause segmentation faults). See more on thread safety section in *tplogconfig(3)*.
0071 
0072 RETURN VALUE
0073 ------------
0074 On success, *tplogsetreqfile()* return zero; on error, -1 is returned, 
0075 with *tperrno* set to indicate the error.
0076 
0077 ERRORS
0078 ------
0079 Note that *tpstrerror()* returns generic error message plus custom message 
0080 with debug info from last function call.
0081 
0082 *TPEINVAL* Missing file name in parameters (invalid parameter combination).
0083 
0084 *TPENOENT* No service ('filesvc' parameter) advertised in system.
0085 
0086 *TPETIME* Service did not reply in given time ('NDRX_TOUT'). 
0087 
0088 *TPESVCFAIL* Service returned 'TPFAIL'. This is application level failure.
0089 
0090 *TPESVCERR* System level service failure. Server died during the message 
0091 presence in service queue.
0092 
0093 *TPESYSTEM* System failure occurred during serving. See logs i.e. user log, 
0094 or debugs for more info.
0095 
0096 *TPEOS* System failure occurred during serving. See logs i.e. user log, 
0097 or debugs for more info.
0098 
0099 
0100 EXAMPLE
0101 -------
0102 See *atmitest/test031_logging/atmiclt31.c* for sample code.
0103 
0104 BUGS
0105 ----
0106 Report bugs to support@mavimax.com
0107 
0108 SEE ALSO
0109 --------
0110 *tploggetreqfile(3)* *tploggetbufreqfile(3)* *tplogconfig(3)* *tplogdump(3)*
0111 *tplogdumpdiff(3)* *tplog(3)* *tplogsetreqfile_direct(3)* *ex_devguide(guides)*
0112 
0113 COPYING
0114 -------
0115 (C) Mavimax, Ltd
0116