Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Thanks Lennart for your info. I will put that header back before pushing. Regards, Vu > -Original Message- > From: Lennart Lund [mailto:lennart.l...@ericsson.com] > Sent: Thursday, August 4, 2016 2:10 PM > To: Vu Minh Nguyen; > mahesh.va...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1 of 4] log: add one new option -f to saflogger tool > [#1315] > > Hi Vu > > [Vu] The header "saAis.h" contains core definitions. It must be included in > > each service API header file (e.g "saLog.h") > > I think the application no need to include that core header file, include > > service API header file is enough. > > It is correct as you say that saAis.h has to be included in almost every file but > as a general rule I still think it is better to directly include all header files that > contains anything that is used directly and to not include files that does not > contain anything that is used directly. Also header files must contain all > includes used directly, there shall not be any dependency on that some other > header file has been included. > A good thing to do and this will ensure that a header file is indeed > independent is to always include the .h file as the first include in the > corresponding .c file when applicable. > With this said my ACK is still valid whatever your decision is in this matter > > Thanks > Lennart > > > -Original Message- > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > > Sent: den 4 augusti 2016 07:07 > > To: Lennart Lund ; mahesh.va...@oracle.com > > Cc: opensaf-devel@lists.sourceforge.net > > Subject: RE: [PATCH 1 of 4] log: add one new option -f to saflogger tool > > [#1315] > > > > Hi Lennart, > > > > Please see my respond inline [Vu]. > > > > Regards, Vu > > > > > -Original Message- > > > From: Lennart Lund [mailto:lennart.l...@ericsson.com] > > > Sent: Wednesday, August 3, 2016 5:10 PM > > > To: Vu Minh Nguyen ; > > > mahesh.va...@oracle.com > > > Cc: opensaf-devel@lists.sourceforge.net > > > Subject: RE: [PATCH 1 of 4] log: add one new option -f to saflogger tool > > > [#1315] > > > > > > Hi Vu > > > > > > For saflogger tool ACK with minor comments > > > > > > See also comments inline [Lennart] > > > > > > Thanks > > > Lennart > > > > > > > -Original Message- > > > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > > > > Sent: den 1 juli 2016 12:42 > > > > To: mahesh.va...@oracle.com; Lennart Lund > > > > > > Cc: opensaf-devel@lists.sourceforge.net > > > > Subject: [PATCH 1 of 4] log: add one new option -f to saflogger tool > > > [#1315] > > > > > > > > osaf/tools/saflog/saflogger/Makefile.am | 1 + > > > > osaf/tools/saflog/saflogger/saf_logger.c | 90 > > > > ++- > > > > 2 files changed, 75 insertions(+), 16 deletions(-) > > > > > > > > > > > > With app stream, saflogger used app stream DN as logFileName. > > > > With Long DN, the app stream DN could be longer than 255 characters > in > > > > length. > > > > > > > > This patch provides one new option -f . > > > > This option is only applicable for app stream. > > > > > > > > diff --git a/osaf/tools/saflog/saflogger/Makefile.am > > > > b/osaf/tools/saflog/saflogger/Makefile.am > > > > --- a/osaf/tools/saflog/saflogger/Makefile.am > > > > +++ b/osaf/tools/saflog/saflogger/Makefile.am > > > > @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in > > > > bin_PROGRAMS = saflogger > > > > > > > > saflogger_CPPFLAGS = \ > > > > + -DSA_EXTENDED_NAME_SOURCE \ > > > > $(AM_CPPFLAGS) \ > > > > -I$(top_srcdir)/osaf/tools/saflog/include > > > > > > > > diff --git a/osaf/tools/saflog/saflogger/saf_logger.c > > > > b/osaf/tools/saflog/saflogger/saf_logger.c > > > > --- a/osaf/tools/saflog/saflogger/saf_logger.c > > > > +++ b/osaf/tools/saflog/saflogger/saf_logger.c > > > > @@ -37,8 +37,9 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > +#include "osaf_extended_name.h" > > > > > > > > -#include > > > > #include > > > [Lennart] Why removing this include? Many things is this file is used > > directly > > > in this file therefore this file should be included here. > > > If this include is removed it will work anyway since the file is included > > > indirectly via the osaf_extended_name.h file. This is unclear and creates > > an > > > unwanted dependency > > [Vu] The header "saAis.h" contains core definitions. It must be included in > > each service API header file (e.g "saLog.h") > > I think the application no need to include that core header file, include > > service API header file is enough. > > > > > > > > > > > #include "saf_error.h" > > > > @@ -83,7 +84,7 @@ static void usage(void) > > > > printf("\t%s - write log record to log stream\n", progname); > > > > > > > > printf("\nSYNOPSIS\n"); > > > > - printf("\t%s [options]
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Vu [Vu] The header "saAis.h" contains core definitions. It must be included in > each service API header file (e.g "saLog.h") > I think the application no need to include that core header file, include > service API header file is enough. It is correct as you say that saAis.h has to be included in almost every file but as a general rule I still think it is better to directly include all header files that contains anything that is used directly and to not include files that does not contain anything that is used directly. Also header files must contain all includes used directly, there shall not be any dependency on that some other header file has been included. A good thing to do and this will ensure that a header file is indeed independent is to always include the .h file as the first include in the corresponding .c file when applicable. With this said my ACK is still valid whatever your decision is in this matter Thanks Lennart > -Original Message- > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > Sent: den 4 augusti 2016 07:07 > To: Lennart Lund; mahesh.va...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1 of 4] log: add one new option -f to saflogger tool > [#1315] > > Hi Lennart, > > Please see my respond inline [Vu]. > > Regards, Vu > > > -Original Message- > > From: Lennart Lund [mailto:lennart.l...@ericsson.com] > > Sent: Wednesday, August 3, 2016 5:10 PM > > To: Vu Minh Nguyen ; > > mahesh.va...@oracle.com > > Cc: opensaf-devel@lists.sourceforge.net > > Subject: RE: [PATCH 1 of 4] log: add one new option -f to saflogger tool > > [#1315] > > > > Hi Vu > > > > For saflogger tool ACK with minor comments > > > > See also comments inline [Lennart] > > > > Thanks > > Lennart > > > > > -Original Message- > > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > > > Sent: den 1 juli 2016 12:42 > > > To: mahesh.va...@oracle.com; Lennart Lund > > > > Cc: opensaf-devel@lists.sourceforge.net > > > Subject: [PATCH 1 of 4] log: add one new option -f to saflogger tool > > [#1315] > > > > > > osaf/tools/saflog/saflogger/Makefile.am | 1 + > > > osaf/tools/saflog/saflogger/saf_logger.c | 90 > > > ++- > > > 2 files changed, 75 insertions(+), 16 deletions(-) > > > > > > > > > With app stream, saflogger used app stream DN as logFileName. > > > With Long DN, the app stream DN could be longer than 255 characters in > > > length. > > > > > > This patch provides one new option -f . > > > This option is only applicable for app stream. > > > > > > diff --git a/osaf/tools/saflog/saflogger/Makefile.am > > > b/osaf/tools/saflog/saflogger/Makefile.am > > > --- a/osaf/tools/saflog/saflogger/Makefile.am > > > +++ b/osaf/tools/saflog/saflogger/Makefile.am > > > @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in > > > bin_PROGRAMS = saflogger > > > > > > saflogger_CPPFLAGS = \ > > > + -DSA_EXTENDED_NAME_SOURCE \ > > > $(AM_CPPFLAGS) \ > > > -I$(top_srcdir)/osaf/tools/saflog/include > > > > > > diff --git a/osaf/tools/saflog/saflogger/saf_logger.c > > > b/osaf/tools/saflog/saflogger/saf_logger.c > > > --- a/osaf/tools/saflog/saflogger/saf_logger.c > > > +++ b/osaf/tools/saflog/saflogger/saf_logger.c > > > @@ -37,8 +37,9 @@ > > > #include > > > #include > > > #include > > > +#include > > > +#include "osaf_extended_name.h" > > > > > > -#include > > > #include > > [Lennart] Why removing this include? Many things is this file is used > directly > > in this file therefore this file should be included here. > > If this include is removed it will work anyway since the file is included > > indirectly via the osaf_extended_name.h file. This is unclear and creates > an > > unwanted dependency > [Vu] The header "saAis.h" contains core definitions. It must be included in > each service API header file (e.g "saLog.h") > I think the application no need to include that core header file, include > service API header file is enough. > > > > > > > > #include "saf_error.h" > > > @@ -83,7 +84,7 @@ static void usage(void) > > > printf("\t%s - write log record to log stream\n", progname); > > > > > > printf("\nSYNOPSIS\n"); > > > - printf("\t%s [options] [message ...]\n", progname); > > > + printf("\t%s [options] [-f ] [message ...]\n", progname); > > > > > > printf("\nDESCRIPTION\n"); > > > printf("\t%s is a SAF LOG client used to write a log record into a > > > specified log stream.\n", progname); > > > @@ -95,11 +96,16 @@ static void usage(void) > > > printf("\t-n or --notification write to notification > stream\n"); > > > printf("\t-y or --system write to system stream > (default)\n"); > > > printf("\t-a NAME or --application=NAME write to application > > stream > > > NAME (create it if not exist)\n"); > > > + printf("\t-f FILENAMEwrite log record to > FILENAME\n");
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Lennart, Please see my respond inline [Vu]. Regards, Vu > -Original Message- > From: Lennart Lund [mailto:lennart.l...@ericsson.com] > Sent: Wednesday, August 3, 2016 5:10 PM > To: Vu Minh Nguyen; > mahesh.va...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1 of 4] log: add one new option -f to saflogger tool > [#1315] > > Hi Vu > > For saflogger tool ACK with minor comments > > See also comments inline [Lennart] > > Thanks > Lennart > > > -Original Message- > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > > Sent: den 1 juli 2016 12:42 > > To: mahesh.va...@oracle.com; Lennart Lund > > Cc: opensaf-devel@lists.sourceforge.net > > Subject: [PATCH 1 of 4] log: add one new option -f to saflogger tool > [#1315] > > > > osaf/tools/saflog/saflogger/Makefile.am | 1 + > > osaf/tools/saflog/saflogger/saf_logger.c | 90 > > ++- > > 2 files changed, 75 insertions(+), 16 deletions(-) > > > > > > With app stream, saflogger used app stream DN as logFileName. > > With Long DN, the app stream DN could be longer than 255 characters in > > length. > > > > This patch provides one new option -f . > > This option is only applicable for app stream. > > > > diff --git a/osaf/tools/saflog/saflogger/Makefile.am > > b/osaf/tools/saflog/saflogger/Makefile.am > > --- a/osaf/tools/saflog/saflogger/Makefile.am > > +++ b/osaf/tools/saflog/saflogger/Makefile.am > > @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in > > bin_PROGRAMS = saflogger > > > > saflogger_CPPFLAGS = \ > > + -DSA_EXTENDED_NAME_SOURCE \ > > $(AM_CPPFLAGS) \ > > -I$(top_srcdir)/osaf/tools/saflog/include > > > > diff --git a/osaf/tools/saflog/saflogger/saf_logger.c > > b/osaf/tools/saflog/saflogger/saf_logger.c > > --- a/osaf/tools/saflog/saflogger/saf_logger.c > > +++ b/osaf/tools/saflog/saflogger/saf_logger.c > > @@ -37,8 +37,9 @@ > > #include > > #include > > #include > > +#include > > +#include "osaf_extended_name.h" > > > > -#include > > #include > [Lennart] Why removing this include? Many things is this file is used directly > in this file therefore this file should be included here. > If this include is removed it will work anyway since the file is included > indirectly via the osaf_extended_name.h file. This is unclear and creates an > unwanted dependency [Vu] The header "saAis.h" contains core definitions. It must be included in each service API header file (e.g "saLog.h") I think the application no need to include that core header file, include service API header file is enough. > > > > > #include "saf_error.h" > > @@ -83,7 +84,7 @@ static void usage(void) > > printf("\t%s - write log record to log stream\n", progname); > > > > printf("\nSYNOPSIS\n"); > > - printf("\t%s [options] [message ...]\n", progname); > > + printf("\t%s [options] [-f ] [message ...]\n", progname); > > > > printf("\nDESCRIPTION\n"); > > printf("\t%s is a SAF LOG client used to write a log record into a > > specified log stream.\n", progname); > > @@ -95,11 +96,16 @@ static void usage(void) > > printf("\t-n or --notification write to notification stream\n"); > > printf("\t-y or --system write to system stream (default)\n"); > > printf("\t-a NAME or --application=NAME write to application > stream > > NAME (create it if not exist)\n"); > > + printf("\t-f FILENAMEwrite log record to FILENAME\n"); > > printf("\t-s SEV or --severity=SEV use severity SEV, default > > INFO\n"); > > printf("\t\tvalid severity names: emerg, alert, crit, error, warn, > > notice, info\n"); > > + printf("\nNOTES\n"); > > + printf("\t1) -f is only applicable for app stream.\n"); > > + printf("\t1) length must not be longer than 255 > > characters.\n"); > > > > printf("\nEXAMPLES\n"); > > printf("\tsaflogger -a safLgStrCfg=Test \"Hello world\"\n"); > > + printf("\tsaflogger -a safLgStrCfg=Test -f testLogFile \"Hello > > world\"\n"); > > printf("\tsaflogger -s crit \"I am going down\"\n\n"); > > } > > > > @@ -230,7 +236,7 @@ static SaLogSeverityT get_severity(char > > int main(int argc, char *argv[]) > > { > > int c; > > - SaNameT logStreamName = {.length = 0 }; > > + SaNameT logStreamName; > > SaLogFileCreateAttributesT_2 *logFileCreateAttributes = NULL; > > SaLogFileCreateAttributesT_2 appLogFileCreateAttributes; > > SaLogStreamOpenFlagsT logStreamOpenFlags = 0; > > @@ -253,6 +259,7 @@ int main(int argc, char *argv[]) > > SaLogStreamHandleT logStreamHandle; > > SaSelectionObjectT selectionObject; > > unsigned int wait_time; > > + bool is_appstream = false, f_opt = false; > > > > srandom(getpid()); > > > > @@ -261,11 +268,23 @@ int main(int argc, char *argv[]) > > exit(EXIT_FAILURE); > > } > > > > - sprintf((char *)logSvcUsrName.value, "%s.%u@%s", "saflogger", >
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Vu For saflogger tool ACK with minor comments See also comments inline [Lennart] Thanks Lennart > -Original Message- > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > Sent: den 1 juli 2016 12:42 > To: mahesh.va...@oracle.com; Lennart Lund> Cc: opensaf-devel@lists.sourceforge.net > Subject: [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315] > > osaf/tools/saflog/saflogger/Makefile.am | 1 + > osaf/tools/saflog/saflogger/saf_logger.c | 90 > ++- > 2 files changed, 75 insertions(+), 16 deletions(-) > > > With app stream, saflogger used app stream DN as logFileName. > With Long DN, the app stream DN could be longer than 255 characters in > length. > > This patch provides one new option -f . > This option is only applicable for app stream. > > diff --git a/osaf/tools/saflog/saflogger/Makefile.am > b/osaf/tools/saflog/saflogger/Makefile.am > --- a/osaf/tools/saflog/saflogger/Makefile.am > +++ b/osaf/tools/saflog/saflogger/Makefile.am > @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in > bin_PROGRAMS = saflogger > > saflogger_CPPFLAGS = \ > + -DSA_EXTENDED_NAME_SOURCE \ > $(AM_CPPFLAGS) \ > -I$(top_srcdir)/osaf/tools/saflog/include > > diff --git a/osaf/tools/saflog/saflogger/saf_logger.c > b/osaf/tools/saflog/saflogger/saf_logger.c > --- a/osaf/tools/saflog/saflogger/saf_logger.c > +++ b/osaf/tools/saflog/saflogger/saf_logger.c > @@ -37,8 +37,9 @@ > #include > #include > #include > +#include > +#include "osaf_extended_name.h" > > -#include > #include [Lennart] Why removing this include? Many things is this file is used directly in this file therefore this file should be included here. If this include is removed it will work anyway since the file is included indirectly via the osaf_extended_name.h file. This is unclear and creates an unwanted dependency > > #include "saf_error.h" > @@ -83,7 +84,7 @@ static void usage(void) > printf("\t%s - write log record to log stream\n", progname); > > printf("\nSYNOPSIS\n"); > - printf("\t%s [options] [message ...]\n", progname); > + printf("\t%s [options] [-f ] [message ...]\n", progname); > > printf("\nDESCRIPTION\n"); > printf("\t%s is a SAF LOG client used to write a log record into a > specified log stream.\n", progname); > @@ -95,11 +96,16 @@ static void usage(void) > printf("\t-n or --notification write to notification > stream\n"); > printf("\t-y or --system write to system stream > (default)\n"); > printf("\t-a NAME or --application=NAME write to application stream > NAME (create it if not exist)\n"); > + printf("\t-f FILENAMEwrite log record to > FILENAME\n"); > printf("\t-s SEV or --severity=SEV use severity SEV, default > INFO\n"); > printf("\t\tvalid severity names: emerg, alert, crit, error, warn, > notice, info\n"); > + printf("\nNOTES\n"); > + printf("\t1) -f is only applicable for app stream.\n"); > + printf("\t1) length must not be longer than 255 > characters.\n"); > > printf("\nEXAMPLES\n"); > printf("\tsaflogger -a safLgStrCfg=Test \"Hello world\"\n"); > + printf("\tsaflogger -a safLgStrCfg=Test -f testLogFile \"Hello > world\"\n"); > printf("\tsaflogger -s crit \"I am going down\"\n\n"); > } > > @@ -230,7 +236,7 @@ static SaLogSeverityT get_severity(char > int main(int argc, char *argv[]) > { > int c; > - SaNameT logStreamName = {.length = 0 }; > + SaNameT logStreamName; > SaLogFileCreateAttributesT_2 *logFileCreateAttributes = NULL; > SaLogFileCreateAttributesT_2 appLogFileCreateAttributes; > SaLogStreamOpenFlagsT logStreamOpenFlags = 0; > @@ -253,6 +259,7 @@ int main(int argc, char *argv[]) > SaLogStreamHandleT logStreamHandle; > SaSelectionObjectT selectionObject; > unsigned int wait_time; > + bool is_appstream = false, f_opt = false; > > srandom(getpid()); > > @@ -261,11 +268,23 @@ int main(int argc, char *argv[]) > exit(EXIT_FAILURE); > } > > - sprintf((char *)logSvcUsrName.value, "%s.%u@%s", "saflogger", > getpid(), hostname); > - logSvcUsrName.length = strlen((char *)logSvcUsrName.value); > + if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > + fprintf(stderr, "Failed to enable Extended SaNameT"); > + exit(EXIT_FAILURE); > + } > + > + /** > + * osaf_extended_name_init() is added in case osaf_extended_* > APIs > + * are used before saLogInitialize(). > + */ > + osaf_extended_name_init(); > + > + char svcUserName[kOsafMaxDnLength]; > + snprintf(svcUserName, sizeof(svcUserName), "%s.%u@%s", > "saflogger", getpid(), hostname); > + saAisNameLend(svcUserName, ); > > /* Setup default values */ > - strcpy((char *)logStreamName.value, SA_LOG_STREAM_SYSTEM); > /* system
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi! The file "osaf_extended_name.h" and all the functions declared in it are intended to be used when implementing support for the extended SaNameT type in OpenSAF agent libraries. The saflogger tool is similar to any application which is using the OpenSAF libraries, so it should be adapted to the extended SaNameT type in the same way as ordinary applications as described in OpenSAF_Extensions_PR.odt. / Anders Widell On 07/11/2016 07:17 AM, Vu Minh Nguyen wrote: > Hi Mahesh, > > I would like to add Anders in for his comment. > > Your below concern belongs to extended SaNameT in general, not only for LOG. > I am not sure that use case (?) is valid or not. > > Regards, Vu > >> -Original Message- >> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >> Sent: Monday, July 11, 2016 11:06 AM >> To: Vu Minh Nguyen; >> lennart.l...@ericsson.com >> Cc: opensaf-devel@lists.sourceforge.net >> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger tool >> [#1315] >> >> Hi Vu, >> >> On 7/8/2016 4:08 PM, Vu Minh Nguyen wrote: >>> Hi Mahesh, >>> >>> To make long DN work (e.g: long DN at @Ng token), we have to do some >>> settings first. IMM is one of them. >>> You can refer to ` setUpTestEnv()` @ tet_log_longDN.c for details on > this. >> [AVM] I understand that the Agent has to do >> `setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1);` >> to enable long DN , which I did for my LAG ( An application) , as we >> know LAGA using IMMA,NTFA , ect ... implicitly, >> in such case user will not expect , for each Agent that implicitly >> getting used ( user un aware) , >> what was trying to say is for all implicit agent long DN should be >> enabled implicitly. >> >> -AVM >> >>> One question, have you tried to run the added test suite #13 for > verifying >>> long DN? >>> With this test suite, before starting test, each TC does change > precondition >>> settings to make long DN work . >>> >>> If you want to see the verification data, enable the environment ` >>> LOGTEST_ENABLE_STDOUT`. >>> >>> E.g: >>> # LOGTEST_ENABLE_STDOUT=1 logtest 13 >>> >>> Regards, Vu >>> -Original Message- From: A V Mahesh [mailto:mahesh.va...@oracle.com] Sent: Friday, July 8, 2016 4:00 PM To: Vu Minh Nguyen ; lennart.l...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger > tool [#1315] Hi Vu, While validating the patch , i received following errors , do we need > to apply any other IMM patchs to validate this patch ? >> == # Jul 8 13:03:03 SC-1 osafimmnd[23888]: NO ERR_INVALID_PARAM: RDN attribute value >> safLgStr=L >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL L is too large: 997. Max length is 64 for SaStringT Jul 8 13:03:03 SC-1 osaflogd[23903]: WA saImmOiRtObjectCreate_2 returned 7 for >> safLgStr=L >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >>
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Mahesh, I would like to add Anders in for his comment. Your below concern belongs to extended SaNameT in general, not only for LOG. I am not sure that use case (?) is valid or not. Regards, Vu > -Original Message- > From: A V Mahesh [mailto:mahesh.va...@oracle.com] > Sent: Monday, July 11, 2016 11:06 AM > To: Vu Minh Nguyen; > lennart.l...@ericsson.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger tool > [#1315] > > Hi Vu, > > On 7/8/2016 4:08 PM, Vu Minh Nguyen wrote: > > Hi Mahesh, > > > > To make long DN work (e.g: long DN at @Ng token), we have to do some > > settings first. IMM is one of them. > > You can refer to ` setUpTestEnv()` @ tet_log_longDN.c for details on this. > [AVM] I understand that the Agent has to do > `setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1);` > to enable long DN , which I did for my LAG ( An application) , as we > know LAGA using IMMA,NTFA , ect ... implicitly, > in such case user will not expect , for each Agent that implicitly > getting used ( user un aware) , > what was trying to say is for all implicit agent long DN should be > enabled implicitly. > > -AVM > > > > > One question, have you tried to run the added test suite #13 for verifying > > long DN? > > With this test suite, before starting test, each TC does change precondition > > settings to make long DN work . > > > > If you want to see the verification data, enable the environment ` > > LOGTEST_ENABLE_STDOUT`. > > > > E.g: > > # LOGTEST_ENABLE_STDOUT=1 logtest 13 > > > > Regards, Vu > > > >> -Original Message- > >> From: A V Mahesh [mailto:mahesh.va...@oracle.com] > >> Sent: Friday, July 8, 2016 4:00 PM > >> To: Vu Minh Nguyen ; > >> lennart.l...@ericsson.com > >> Cc: opensaf-devel@lists.sourceforge.net > >> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger tool > >> [#1315] > >> > >> Hi Vu, > >> > >> While validating the patch , i received following errors , do we need to > >> apply any other IMM patchs > >> > >> to validate this patch ? > >> > >> > == > >> > >> > >> # Jul 8 13:03:03 SC-1 osafimmnd[23888]: NO ERR_INVALID_PARAM: RDN > >> attribute value > >> > safLgStr=L > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> L > >> is too large: 997. Max length is 64 for SaStringT > >> Jul 8 13:03:03 SC-1 osaflogd[23903]: WA saImmOiRtObjectCreate_2 > >> returned 7 for > >> > safLgStr=L > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> > LL > >> L, > >> parent (null) > >> > >> > == > >> > >> > >> -AVM > >> > >> > >> On 7/8/2016 10:19 AM, A V Mahesh wrote: > >>> Hi Vu, > >>> > >>> On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: > I zipped all the patches in
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Vu, On 7/8/2016 4:08 PM, Vu Minh Nguyen wrote: > Hi Mahesh, > > To make long DN work (e.g: long DN at @Ng token), we have to do some > settings first. IMM is one of them. > You can refer to ` setUpTestEnv()` @ tet_log_longDN.c for details on this. [AVM] I understand that the Agent has to do `setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1);` to enable long DN , which I did for my LAG ( An application) , as we know LAGA using IMMA,NTFA , ect ... implicitly, in such case user will not expect , for each Agent that implicitly getting used ( user un aware) , what was trying to say is for all implicit agent long DN should be enabled implicitly. -AVM > > One question, have you tried to run the added test suite #13 for verifying > long DN? > With this test suite, before starting test, each TC does change precondition > settings to make long DN work . > > If you want to see the verification data, enable the environment ` > LOGTEST_ENABLE_STDOUT`. > > E.g: > # LOGTEST_ENABLE_STDOUT=1 logtest 13 > > Regards, Vu > >> -Original Message- >> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >> Sent: Friday, July 8, 2016 4:00 PM >> To: Vu Minh Nguyen; >> lennart.l...@ericsson.com >> Cc: opensaf-devel@lists.sourceforge.net >> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger tool >> [#1315] >> >> Hi Vu, >> >> While validating the patch , i received following errors , do we need to >> apply any other IMM patchs >> >> to validate this patch ? >> >> == >> >> >> # Jul 8 13:03:03 SC-1 osafimmnd[23888]: NO ERR_INVALID_PARAM: RDN >> attribute value >> safLgStr=L >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> L >> is too large: 997. Max length is 64 for SaStringT >> Jul 8 13:03:03 SC-1 osaflogd[23903]: WA saImmOiRtObjectCreate_2 >> returned 7 for >> safLgStr=L >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> LL >> L, >> parent (null) >> >> == >> >> >> -AVM >> >> >> On 7/8/2016 10:19 AM, A V Mahesh wrote: >>> Hi Vu, >>> >>> On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: I zipped all the patches in attached file, you can try to apply it in the meantime. Thanks. >>> Thanks The attached patches are getting applied. >>> >>> -AVM >>> >>> On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: Hi Mahesh, I have tried to apply these patches (copy from emails [PATCH x of 4]) > to latest staging and it works. And I see you get failed at the first patch (saflogger tool), then I guess the patches you applied were broken somehow. Can you send me the saflogger patch (1st patch) that you used? I will check it to see why you get failed. I zipped all the patches in attached file, you can try to apply it in the meantime. Thanks. Regards, Vu > -Original Message- > From: A V Mahesh
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Mahesh, To make long DN work (e.g: long DN at @Ng token), we have to do some settings first. IMM is one of them. You can refer to ` setUpTestEnv()` @ tet_log_longDN.c for details on this. One question, have you tried to run the added test suite #13 for verifying long DN? With this test suite, before starting test, each TC does change precondition settings to make long DN work . If you want to see the verification data, enable the environment ` LOGTEST_ENABLE_STDOUT`. E.g: # LOGTEST_ENABLE_STDOUT=1 logtest 13 Regards, Vu > -Original Message- > From: A V Mahesh [mailto:mahesh.va...@oracle.com] > Sent: Friday, July 8, 2016 4:00 PM > To: Vu Minh Nguyen; > lennart.l...@ericsson.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger tool > [#1315] > > Hi Vu, > > While validating the patch , i received following errors , do we need to > apply any other IMM patchs > > to validate this patch ? > > == > > > # Jul 8 13:03:03 SC-1 osafimmnd[23888]: NO ERR_INVALID_PARAM: RDN > attribute value > safLgStr=L > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > L > is too large: 997. Max length is 64 for SaStringT > Jul 8 13:03:03 SC-1 osaflogd[23903]: WA saImmOiRtObjectCreate_2 > returned 7 for > safLgStr=L > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > LL > L, > parent (null) > > == > > > -AVM > > > On 7/8/2016 10:19 AM, A V Mahesh wrote: > > Hi Vu, > > > > On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: > >> I zipped all the patches in attached file, you can try to apply it in > >> the > >> meantime. Thanks. > > > > Thanks The attached patches are getting applied. > > > > -AVM > > > > On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: > >> Hi Mahesh, > >> > >> I have tried to apply these patches (copy from emails [PATCH x of 4]) to > >> latest staging and it works. > >> And I see you get failed at the first patch (saflogger tool), then I > >> guess > >> the patches you applied were broken somehow. > >> > >> Can you send me the saflogger patch (1st patch) that you used? I will > >> check > >> it to see why you get failed. > >> > >> I zipped all the patches in attached file, you can try to apply it in > >> the > >> meantime. Thanks. > >> > >> Regards, Vu > >> > >>> -Original Message- > >>> From: A V Mahesh [mailto:mahesh.va...@oracle.com] > >>> Sent: Friday, July 8, 2016 11:07 AM > >>> To: Vu Minh Nguyen ; > >>> lennart.l...@ericsson.com > >>> Cc: opensaf-devel@lists.sourceforge.net > >>> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger > >>> tool > >>> [#1315] > >>> > >>> Hi Vu, > >>> > >>> This patch is not being applied on latest staging , can you tell on > >>> which changesset this will cleanly appy ? > >>> > >>> > == > >>>
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Mahesh, It looks like long DN is no allowed in IMM. Check how you have configured IMM. Thanks, Zoran -Original Message- From: A V Mahesh [mailto:mahesh.va...@oracle.com] Sent: den 8 juli 2016 11:00 To: Vu Minh Nguyen; Lennart Lund Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315] Hi Vu, While validating the patch , i received following errors , do we need to apply any other IMM patchs to validate this patch ? == # Jul 8 13:03:03 SC-1 osafimmnd[23888]: NO ERR_INVALID_PARAM: RDN attribute value safLgStr=LL LL is too large: 997. Max length is 64 for SaStringT Jul 8 13:03:03 SC-1 osaflogd[23903]: WA saImmOiRtObjectCreate_2 returned 7 for safLgStr=LLL L, parent (null) == -AVM On 7/8/2016 10:19 AM, A V Mahesh wrote: > Hi Vu, > > On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: >> I zipped all the patches in attached file, you can try to apply it in >> the meantime. Thanks. > > Thanks The attached patches are getting applied. > > -AVM > > On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: >> Hi Mahesh, >> >> I have tried to apply these patches (copy from emails [PATCH x of 4]) >> to latest staging and it works. >> And I see you get failed at the first patch (saflogger tool), then I >> guess the patches you applied were broken somehow. >> >> Can you send me the saflogger patch (1st patch) that you used? I will >> check it to see why you get failed. >> >> I zipped all the patches in attached file, you can try to apply it in >> the meantime. Thanks. >> >> Regards, Vu >> >>> -Original Message- >>> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >>> Sent: Friday, July 8, 2016 11:07 AM >>> To: Vu Minh Nguyen <vu.m.ngu...@dektech.com.au>; >>> lennart.l...@ericsson.com >>> Cc: opensaf-devel@lists.sourceforge.net >>> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger >>> tool [#1315] >>> >>> Hi Vu, >>> >>> This patch is not being applied on latest staging , can you tell on >>> which changesset this will cleanly appy ? >>> >>> == >>> >>> >>> patching file osaf/tools/saflog/saflogger/Makefile.am >>> Hunk #1 FAILED at 22. >>> 1 out of 1 hunk FAILED -- saving rejects to file >>> osaf/tools/saflog/saflogger/Makefile.am.rej >>> patching file osaf/tools/saflog/saflogger/saf_logger.c >>> Hunk #2 FAILED at 84. >>> Hunk #3 FAILED at 96. >>> Hunk #4 FAILED at 236. >>> Hunk #
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Vu, While validating the patch , i received following errors , do we need to apply any other IMM patchs to validate this patch ? == # Jul 8 13:03:03 SC-1 osafimmnd[23888]: NO ERR_INVALID_PARAM: RDN attribute value safLgStr= is too large: 997. Max length is 64 for SaStringT Jul 8 13:03:03 SC-1 osaflogd[23903]: WA saImmOiRtObjectCreate_2 returned 7 for safLgStr=, parent (null) == -AVM On 7/8/2016 10:19 AM, A V Mahesh wrote: > Hi Vu, > > On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: >> I zipped all the patches in attached file, you can try to apply it in >> the >> meantime. Thanks. > > Thanks The attached patches are getting applied. > > -AVM > > On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: >> Hi Mahesh, >> >> I have tried to apply these patches (copy from emails [PATCH x of 4]) to >> latest staging and it works. >> And I see you get failed at the first patch (saflogger tool), then I >> guess >> the patches you applied were broken somehow. >> >> Can you send me the saflogger patch (1st patch) that you used? I will >> check >> it to see why you get failed. >> >> I zipped all the patches in attached file, you can try to apply it in >> the >> meantime. Thanks. >> >> Regards, Vu >> >>> -Original Message- >>> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >>> Sent: Friday, July 8, 2016 11:07 AM >>> To: Vu Minh Nguyen; >>> lennart.l...@ericsson.com >>> Cc: opensaf-devel@lists.sourceforge.net >>> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger >>> tool >>> [#1315] >>> >>> Hi Vu, >>> >>> This patch is not being applied on latest staging , can you tell on >>> which changesset this will cleanly appy ? >>> >>> == >>> >>> >>> patching file osaf/tools/saflog/saflogger/Makefile.am >>> Hunk #1 FAILED at 22. >>> 1 out of 1 hunk FAILED -- saving rejects to file >>> osaf/tools/saflog/saflogger/Makefile.am.rej >>> patching file osaf/tools/saflog/saflogger/saf_logger.c >>> Hunk #2 FAILED at 84. >>> Hunk #3 FAILED at 96. >>> Hunk #4 FAILED at 236. >>> Hunk #5 FAILED at 259. >>> Hunk #6 FAILED at 268. >>> Hunk #7 FAILED at 299. >>> Hunk #8 FAILED at 367. >>> Hunk #9 FAILED at 411. >>> 8 out of 9 hunks FAILED -- saving rejects to file >>> osaf/tools/saflog/saflogger/saf_logger.c.rej >>> >>> == >>> >>> >>> -AVM >>> >>> On 7/1/2016 4:12 PM, Vu Minh Nguyen wrote: osaf/tools/saflog/saflogger/Makefile.am | 1 + osaf/tools/saflog/saflogger/saf_logger.c | 90 >>> ++- 2 files changed, 75 insertions(+), 16 deletions(-) With app stream, saflogger used app stream DN as logFileName. With Long DN, the app stream DN could be longer than 255
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Vu, On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: > I zipped all the patches in attached file, you can try to apply it in the > meantime. Thanks. Thanks The attached patches are getting applied. -AVM On 7/8/2016 10:11 AM, Vu Minh Nguyen wrote: > Hi Mahesh, > > I have tried to apply these patches (copy from emails [PATCH x of 4]) to > latest staging and it works. > And I see you get failed at the first patch (saflogger tool), then I guess > the patches you applied were broken somehow. > > Can you send me the saflogger patch (1st patch) that you used? I will check > it to see why you get failed. > > I zipped all the patches in attached file, you can try to apply it in the > meantime. Thanks. > > Regards, Vu > >> -Original Message- >> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >> Sent: Friday, July 8, 2016 11:07 AM >> To: Vu Minh Nguyen; >> lennart.l...@ericsson.com >> Cc: opensaf-devel@lists.sourceforge.net >> Subject: Re: [PATCH 1 of 4] log: add one new option -f to saflogger tool >> [#1315] >> >> Hi Vu, >> >> This patch is not being applied on latest staging , can you tell on >> which changesset this will cleanly appy ? >> >> == >> >> >> patching file osaf/tools/saflog/saflogger/Makefile.am >> Hunk #1 FAILED at 22. >> 1 out of 1 hunk FAILED -- saving rejects to file >> osaf/tools/saflog/saflogger/Makefile.am.rej >> patching file osaf/tools/saflog/saflogger/saf_logger.c >> Hunk #2 FAILED at 84. >> Hunk #3 FAILED at 96. >> Hunk #4 FAILED at 236. >> Hunk #5 FAILED at 259. >> Hunk #6 FAILED at 268. >> Hunk #7 FAILED at 299. >> Hunk #8 FAILED at 367. >> Hunk #9 FAILED at 411. >> 8 out of 9 hunks FAILED -- saving rejects to file >> osaf/tools/saflog/saflogger/saf_logger.c.rej >> >> == >> >> >> -AVM >> >> On 7/1/2016 4:12 PM, Vu Minh Nguyen wrote: >>>osaf/tools/saflog/saflogger/Makefile.am | 1 + >>>osaf/tools/saflog/saflogger/saf_logger.c | 90 >> ++- >>>2 files changed, 75 insertions(+), 16 deletions(-) >>> >>> >>> With app stream, saflogger used app stream DN as logFileName. >>> With Long DN, the app stream DN could be longer than 255 characters in >> length. >>> This patch provides one new option -f . >>> This option is only applicable for app stream. >>> >>> diff --git a/osaf/tools/saflog/saflogger/Makefile.am >> b/osaf/tools/saflog/saflogger/Makefile.am >>> --- a/osaf/tools/saflog/saflogger/Makefile.am >>> +++ b/osaf/tools/saflog/saflogger/Makefile.am >>> @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in >>>bin_PROGRAMS = saflogger >>> >>>saflogger_CPPFLAGS = \ >>> + -DSA_EXTENDED_NAME_SOURCE \ >>> $(AM_CPPFLAGS) \ >>> -I$(top_srcdir)/osaf/tools/saflog/include >>> >>> diff --git a/osaf/tools/saflog/saflogger/saf_logger.c >> b/osaf/tools/saflog/saflogger/saf_logger.c >>> --- a/osaf/tools/saflog/saflogger/saf_logger.c >>> +++ b/osaf/tools/saflog/saflogger/saf_logger.c >>> @@ -37,8 +37,9 @@ >>>#include >>>#include >>>#include >>> +#include >>> +#include "osaf_extended_name.h" >>> >>> -#include >>>#include >>> >>>#include "saf_error.h" >>> @@ -83,7 +84,7 @@ static void usage(void) >>> printf("\t%s - write log record to log stream\n", progname); >>> >>> printf("\nSYNOPSIS\n"); >>> - printf("\t%s [options] [message ...]\n", progname); >>> + printf("\t%s [options] [-f ] [message ...]\n", progname); >>> >>> printf("\nDESCRIPTION\n"); >>> printf("\t%s is a SAF LOG client used to write a log record into a >> specified log stream.\n", progname); >>> @@ -95,11 +96,16 @@ static void usage(void) >>> printf("\t-n or --notification write to notification > stream\n"); >>> printf("\t-y or --system write to system stream > (default)\n"); >>> printf("\t-a NAME or --application=NAME write to application >> stream NAME (create it if not exist)\n"); >>> + printf("\t-f FILENAMEwrite log record to > FILENAME\n"); >>> printf("\t-s SEV or --severity=SEV use severity SEV, default >> INFO\n"); >>> printf("\t\tvalid severity names: emerg, alert, crit, error, warn, >> notice, info\n"); >>> + printf("\nNOTES\n"); >>> + printf("\t1) -f is only applicable for app stream.\n"); >>> + printf("\t1) length must not be longer than 255 >> characters.\n"); >>> printf("\nEXAMPLES\n"); >>> printf("\tsaflogger -a safLgStrCfg=Test \"Hello world\"\n"); >>> + printf("\tsaflogger -a safLgStrCfg=Test -f testLogFile \"Hello >> world\"\n"); >>> printf("\tsaflogger -s crit \"I am going down\"\n\n"); >>>} >>> >>> @@ -230,7 +236,7 @@ static SaLogSeverityT get_severity(char >>>int main(int argc, char *argv[]) >>>{ >>> int c; >>> - SaNameT logStreamName = {.length = 0 }; >>> + SaNameT logStreamName; >>>
Re: [devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
Hi Vu, This patch is not being applied on latest staging , can you tell on which changesset this will cleanly appy ? == patching file osaf/tools/saflog/saflogger/Makefile.am Hunk #1 FAILED at 22. 1 out of 1 hunk FAILED -- saving rejects to file osaf/tools/saflog/saflogger/Makefile.am.rej patching file osaf/tools/saflog/saflogger/saf_logger.c Hunk #2 FAILED at 84. Hunk #3 FAILED at 96. Hunk #4 FAILED at 236. Hunk #5 FAILED at 259. Hunk #6 FAILED at 268. Hunk #7 FAILED at 299. Hunk #8 FAILED at 367. Hunk #9 FAILED at 411. 8 out of 9 hunks FAILED -- saving rejects to file osaf/tools/saflog/saflogger/saf_logger.c.rej == -AVM On 7/1/2016 4:12 PM, Vu Minh Nguyen wrote: > osaf/tools/saflog/saflogger/Makefile.am | 1 + > osaf/tools/saflog/saflogger/saf_logger.c | 90 > ++- > 2 files changed, 75 insertions(+), 16 deletions(-) > > > With app stream, saflogger used app stream DN as logFileName. > With Long DN, the app stream DN could be longer than 255 characters in length. > > This patch provides one new option -f . > This option is only applicable for app stream. > > diff --git a/osaf/tools/saflog/saflogger/Makefile.am > b/osaf/tools/saflog/saflogger/Makefile.am > --- a/osaf/tools/saflog/saflogger/Makefile.am > +++ b/osaf/tools/saflog/saflogger/Makefile.am > @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in > bin_PROGRAMS = saflogger > > saflogger_CPPFLAGS = \ > + -DSA_EXTENDED_NAME_SOURCE \ > $(AM_CPPFLAGS) \ > -I$(top_srcdir)/osaf/tools/saflog/include > > diff --git a/osaf/tools/saflog/saflogger/saf_logger.c > b/osaf/tools/saflog/saflogger/saf_logger.c > --- a/osaf/tools/saflog/saflogger/saf_logger.c > +++ b/osaf/tools/saflog/saflogger/saf_logger.c > @@ -37,8 +37,9 @@ > #include > #include > #include > +#include > +#include "osaf_extended_name.h" > > -#include > #include > > #include "saf_error.h" > @@ -83,7 +84,7 @@ static void usage(void) > printf("\t%s - write log record to log stream\n", progname); > > printf("\nSYNOPSIS\n"); > - printf("\t%s [options] [message ...]\n", progname); > + printf("\t%s [options] [-f ] [message ...]\n", progname); > > printf("\nDESCRIPTION\n"); > printf("\t%s is a SAF LOG client used to write a log record into a > specified log stream.\n", progname); > @@ -95,11 +96,16 @@ static void usage(void) > printf("\t-n or --notification write to notification > stream\n"); > printf("\t-y or --system write to system stream > (default)\n"); > printf("\t-a NAME or --application=NAME write to application stream > NAME (create it if not exist)\n"); > + printf("\t-f FILENAMEwrite log record to > FILENAME\n"); > printf("\t-s SEV or --severity=SEV use severity SEV, default > INFO\n"); > printf("\t\tvalid severity names: emerg, alert, crit, error, warn, > notice, info\n"); > + printf("\nNOTES\n"); > + printf("\t1) -f is only applicable for app stream.\n"); > + printf("\t1) length must not be longer than 255 > characters.\n"); > > printf("\nEXAMPLES\n"); > printf("\tsaflogger -a safLgStrCfg=Test \"Hello world\"\n"); > + printf("\tsaflogger -a safLgStrCfg=Test -f testLogFile \"Hello > world\"\n"); > printf("\tsaflogger -s crit \"I am going down\"\n\n"); > } > > @@ -230,7 +236,7 @@ static SaLogSeverityT get_severity(char > int main(int argc, char *argv[]) > { > int c; > - SaNameT logStreamName = {.length = 0 }; > + SaNameT logStreamName; > SaLogFileCreateAttributesT_2 *logFileCreateAttributes = NULL; > SaLogFileCreateAttributesT_2 appLogFileCreateAttributes; > SaLogStreamOpenFlagsT logStreamOpenFlags = 0; > @@ -253,6 +259,7 @@ int main(int argc, char *argv[]) > SaLogStreamHandleT logStreamHandle; > SaSelectionObjectT selectionObject; > unsigned int wait_time; > + bool is_appstream = false, f_opt = false; > > srandom(getpid()); > > @@ -261,11 +268,23 @@ int main(int argc, char *argv[]) > exit(EXIT_FAILURE); > } > > - sprintf((char *)logSvcUsrName.value, "%s.%u@%s", "saflogger", getpid(), > hostname); > - logSvcUsrName.length = strlen((char *)logSvcUsrName.value); > + if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > + fprintf(stderr, "Failed to enable Extended SaNameT"); > + exit(EXIT_FAILURE); > + } > + > + /** > + * osaf_extended_name_init() is added in case osaf_extended_* APIs > + * are used before saLogInitialize(). > + */ > + osaf_extended_name_init(); > + > + char svcUserName[kOsafMaxDnLength]; > + snprintf(svcUserName, sizeof(svcUserName), "%s.%u@%s", "saflogger", > getpid(), hostname); > +
[devel] [PATCH 1 of 4] log: add one new option -f to saflogger tool [#1315]
osaf/tools/saflog/saflogger/Makefile.am | 1 + osaf/tools/saflog/saflogger/saf_logger.c | 90 ++- 2 files changed, 75 insertions(+), 16 deletions(-) With app stream, saflogger used app stream DN as logFileName. With Long DN, the app stream DN could be longer than 255 characters in length. This patch provides one new option -f . This option is only applicable for app stream. diff --git a/osaf/tools/saflog/saflogger/Makefile.am b/osaf/tools/saflog/saflogger/Makefile.am --- a/osaf/tools/saflog/saflogger/Makefile.am +++ b/osaf/tools/saflog/saflogger/Makefile.am @@ -22,6 +22,7 @@ MAINTAINERCLEANFILES = Makefile.in bin_PROGRAMS = saflogger saflogger_CPPFLAGS = \ + -DSA_EXTENDED_NAME_SOURCE \ $(AM_CPPFLAGS) \ -I$(top_srcdir)/osaf/tools/saflog/include diff --git a/osaf/tools/saflog/saflogger/saf_logger.c b/osaf/tools/saflog/saflogger/saf_logger.c --- a/osaf/tools/saflog/saflogger/saf_logger.c +++ b/osaf/tools/saflog/saflogger/saf_logger.c @@ -37,8 +37,9 @@ #include #include #include +#include +#include "osaf_extended_name.h" -#include #include #include "saf_error.h" @@ -83,7 +84,7 @@ static void usage(void) printf("\t%s - write log record to log stream\n", progname); printf("\nSYNOPSIS\n"); - printf("\t%s [options] [message ...]\n", progname); + printf("\t%s [options] [-f ] [message ...]\n", progname); printf("\nDESCRIPTION\n"); printf("\t%s is a SAF LOG client used to write a log record into a specified log stream.\n", progname); @@ -95,11 +96,16 @@ static void usage(void) printf("\t-n or --notification write to notification stream\n"); printf("\t-y or --system write to system stream (default)\n"); printf("\t-a NAME or --application=NAME write to application stream NAME (create it if not exist)\n"); + printf("\t-f FILENAMEwrite log record to FILENAME\n"); printf("\t-s SEV or --severity=SEV use severity SEV, default INFO\n"); printf("\t\tvalid severity names: emerg, alert, crit, error, warn, notice, info\n"); + printf("\nNOTES\n"); + printf("\t1) -f is only applicable for app stream.\n"); + printf("\t1) length must not be longer than 255 characters.\n"); printf("\nEXAMPLES\n"); printf("\tsaflogger -a safLgStrCfg=Test \"Hello world\"\n"); + printf("\tsaflogger -a safLgStrCfg=Test -f testLogFile \"Hello world\"\n"); printf("\tsaflogger -s crit \"I am going down\"\n\n"); } @@ -230,7 +236,7 @@ static SaLogSeverityT get_severity(char int main(int argc, char *argv[]) { int c; - SaNameT logStreamName = {.length = 0 }; + SaNameT logStreamName; SaLogFileCreateAttributesT_2 *logFileCreateAttributes = NULL; SaLogFileCreateAttributesT_2 appLogFileCreateAttributes; SaLogStreamOpenFlagsT logStreamOpenFlags = 0; @@ -253,6 +259,7 @@ int main(int argc, char *argv[]) SaLogStreamHandleT logStreamHandle; SaSelectionObjectT selectionObject; unsigned int wait_time; + bool is_appstream = false, f_opt = false; srandom(getpid()); @@ -261,11 +268,23 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - sprintf((char *)logSvcUsrName.value, "%s.%u@%s", "saflogger", getpid(), hostname); - logSvcUsrName.length = strlen((char *)logSvcUsrName.value); + if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { + fprintf(stderr, "Failed to enable Extended SaNameT"); + exit(EXIT_FAILURE); + } + + /** +* osaf_extended_name_init() is added in case osaf_extended_* APIs +* are used before saLogInitialize(). +*/ + osaf_extended_name_init(); + + char svcUserName[kOsafMaxDnLength]; + snprintf(svcUserName, sizeof(svcUserName), "%s.%u@%s", "saflogger", getpid(), hostname); + saAisNameLend(svcUserName, ); /* Setup default values */ - strcpy((char *)logStreamName.value, SA_LOG_STREAM_SYSTEM); /* system stream is default */ + saAisNameLend(SA_LOG_STREAM_SYSTEM, ); logRecord.logTimeStamp = SA_TIME_UNKNOWN; /* LOG service should supply timestamp */ logRecord.logHdrType = SA_LOG_GENERIC_HEADER; logRecord.logHeader.genericHdr.notificationClassId = NULL; @@ -280,32 +299,58 @@ int main(int argc, char *argv[]) appLogFileCreateAttributes.maxFilesRotated = DEFAULT_MAX_FILES_ROTATED; /* Use built-in log file format in log server for app stream */ appLogFileCreateAttributes.logFileFmt = NULL; + appLogFileCreateAttributes.logFileName = NULL; while (1) { - c = getopt_long(argc, argv, "?hlnya:s:", long_options, NULL); + c = getopt_long(argc, argv, "?hlnya:s:f:", long_options, NULL); if (c == -1) {