genivi-audio-manager@lists.genivi.org

development list for the AudioManager

View all threads

AMUtils: New logging utility architecture

KM
Koch, Martin (ESE GmbH; ADITG/ESM)
Fri, Jan 17, 2020 9:17 AM

Hello all,

this time my pull-request is related to an architectural change of the logging utility, which is meant as common utility to support not only the AM daemon, but also public and customer-created plugins and also remote client applications. Therefore it is built into a separate (static or shared) archive.

My colleagues at ADIT prepared splitting the existing class

  •      CAmDltWrapper,
    

which handled (as not suggested by its name) not only logging to the Diagnostic Log and Trace (automotive-dlt) service, but could also stream to a file or to the console. A build-option WITH_DLT could be used to compile the code either with or without DLT support. As this switch affects not only the implementation, but also the declaration file, it needs to be set identically in the AM, all its plugins and all its client applications.

The new architecture consists of a common wrapper class

  •      CAmLogWrapper, which hosts channel-specific logger classes
    

o  CAmLoggerDlt

o  CAmLoggerFile and

o  CAmLoggerStdOut, all implementing the interface specified in

o  IAmLogger
This approach encapsulates the specifics of each output channel into separate files. Especially the availability of the DLT functionality no longer affects all components working with the logging utility. Instead, the library is either built with or without DLT support. There is no need to configure the compilation of the applications (plugins) identically.
In the special case the library is built without DLT support and an application means to use DLT, the output is automatically redirected to stdout.

Of cause, the old logging interface needs to be retained for backward compatibility reason.

I present this new architecture as a 4-commit pull request.

  1.   Introduce the new classes side-by-side with the old mechanism
    
  2.   convert the old class CAmDltWrapper to a pure legacy wrapper around the new architecture, but retain its public interface
    
  3.   fix compilation issue in module test if WITH_DLT is OFF and WITH_TESTS is ON
    
  4.   reorganize daemon, core, utilities and tests to make full use of the new logging architecture
    

With the new version, existing plugins and applications compile and operate as before (at least in my environment), except for one known side-effect:

  •      CAmSerializer.h and TAmPluginTemplate.h no longer indirectly include dlt_user.h. Thus macros like DLT_DECLARE_CONTEXT and DLT_IMPORT_CONTEXT may be undefined in application code unless CAmDltWrapper.h or dlt_user.h is included explicitly.
    

Since the DLT functionality is now encapsulated inside a dedicated class, such declarations are usually superfluous and can be dropped.

I propose increasing the version identifier to 7.7.0 when merging this request.

Best regards

Martin Koch
Advanced Driver Information Technology GmbH
Engineering Software Multimedia (ESM)
Robert-Bosch-Str. 200
31139 Hildesheim
Germany
Tel. +49 5121 49 6954
Fax +49 5121 49 6999
mkoch@de.adit-jv.com
www.adit-jv.com
ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation
Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438
Geschäftsführung: Wilhelm Grabow, Ken Yaguchi
Data protection information: We use your contact information and e-mail communication to process your inquiry and for internal and possibly tax documentation purposes. Your information will only be passed on to third parties if this is necessary to carry out your request or if we are legally obliged to do so.

Hello all, this time my pull-request is related to an architectural change of the logging utility, which is meant as common utility to support not only the AM daemon, but also public and customer-created plugins and also remote client applications. Therefore it is built into a separate (static or shared) archive. My colleagues at ADIT prepared splitting the existing class - CAmDltWrapper, which handled (as not suggested by its name) not only logging to the Diagnostic Log and Trace (automotive-dlt) service, but could also stream to a file or to the console. A build-option WITH_DLT could be used to compile the code either with or without DLT support. As this switch affects not only the implementation, but also the declaration file, it needs to be set identically in the AM, all its plugins and all its client applications. The new architecture consists of a common wrapper class - CAmLogWrapper, which hosts channel-specific logger classes o CAmLoggerDlt o CAmLoggerFile and o CAmLoggerStdOut, all implementing the interface specified in o IAmLogger This approach encapsulates the specifics of each output channel into separate files. Especially the availability of the DLT functionality no longer affects all components working with the logging utility. Instead, the library is either built with or without DLT support. There is no need to configure the compilation of the applications (plugins) identically. In the special case the library is built without DLT support and an application means to use DLT, the output is automatically redirected to stdout. Of cause, the old logging interface needs to be retained for backward compatibility reason. I present this new architecture as a 4-commit pull request. 1. Introduce the new classes side-by-side with the old mechanism 2. convert the old class CAmDltWrapper to a pure legacy wrapper around the new architecture, but retain its public interface 3. fix compilation issue in module test if WITH_DLT is OFF and WITH_TESTS is ON 4. reorganize daemon, core, utilities and tests to make full use of the new logging architecture With the new version, existing plugins and applications compile and operate as before (at least in my environment), except for one known side-effect: - CAmSerializer.h and TAmPluginTemplate.h no longer indirectly include dlt_user.h. Thus macros like DLT_DECLARE_CONTEXT and DLT_IMPORT_CONTEXT may be undefined in application code unless CAmDltWrapper.h or dlt_user.h is included explicitly. Since the DLT functionality is now encapsulated inside a dedicated class, such declarations are usually superfluous and can be dropped. I propose increasing the version identifier to 7.7.0 when merging this request. Best regards Martin Koch Advanced Driver Information Technology GmbH Engineering Software Multimedia (ESM) Robert-Bosch-Str. 200 31139 Hildesheim Germany Tel. +49 5121 49 6954 Fax +49 5121 49 6999 mkoch@de.adit-jv.com www.adit-jv.com ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438 Geschäftsführung: Wilhelm Grabow, Ken Yaguchi Data protection information: We use your contact information and e-mail communication to process your inquiry and for internal and possibly tax documentation purposes. Your information will only be passed on to third parties if this is necessary to carry out your request or if we are legally obliged to do so.
GA
Gunnar Andersson
Sun, Jan 19, 2020 11:10 PM

Hi Martin,

On Fri, 2020-01-17 at 09:17 +0000, Koch, Martin (ESE GmbH; ADITG/ESM)
wrote:

Hello all,

this time my pull-request is related to an architectural change of
the logging utility, which is meant as common utility to support not
only the AM daemon, but also public and customer-created plugins and
also remote client applications.
[trimmed]

I present this new architecture as a 4-commit pull request.

It is a very clear and well organized PR and introduction (and the one
that came after this one also).

Thanks for the clear communication - one tiny thing missing from an
almost perfect introduction email was the link to the PR in question.
It is not hard to find of course, but I place it here in case someone
wants to associate the two archived items in the future:
https://github.com/GENIVI/AudioManager/pull/48

[trimmed]

Thanks,

  • Gunnar

--
Gunnar Andersson gandersson@genivi.org
Development Lead
GENIVI Alliance

Hi Martin, On Fri, 2020-01-17 at 09:17 +0000, Koch, Martin (ESE GmbH; ADITG/ESM) wrote: > Hello all, > > this time my pull-request is related to an architectural change of > the logging utility, which is meant as common utility to support not > only the AM daemon, but also public and customer-created plugins and > also remote client applications. > [trimmed] > I present this new architecture as a 4-commit pull request. It is a very clear and well organized PR and introduction (and the one that came after this one also). Thanks for the clear communication - one tiny thing missing from an almost perfect introduction email was the link to the PR in question. It is not hard to find of course, but I place it here in case someone wants to associate the two archived items in the future: https://github.com/GENIVI/AudioManager/pull/48 > [trimmed] Thanks, - Gunnar -- Gunnar Andersson <gandersson@genivi.org> Development Lead GENIVI Alliance