From c8ed80f86085e01bf262cba3fee3bc81bdf731d3 Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Thu, 22 Oct 2020 09:57:03 +0900 Subject: ss-loggerservice branch 0.1 --- logger_service/server/Makefile | 13 +- logger_service/server/cfg/logrotate.conf | 7 - logger_service/server/cfg/syslog.conf | 4 - .../include/loggerservicedebug_loggerservicelog.h | 2 +- .../server/include/loggerservicedebug_thread_if.h | 2 +- .../include/loggerservicedebug_writer_Evntworker.h | 2 +- .../include/readerWriter/reader/mem_reader.h | 2 +- .../include/readerWriter/reader/queue_reader.h | 2 +- .../server/include/readerWriter/reader/reader.h | 2 +- .../server/include/readerWriter/reader_writer.h | 2 +- .../include/readerWriter/reader_writer_cfg.h | 2 +- .../readerWriter/writer/cached_file_writer.h | 2 +- .../include/readerWriter/writer/file_writer.h | 2 +- .../include/readerWriter/writer/udp_file_writer.h | 2 +- .../include/readerWriter/writer/udp_writer.h | 2 +- .../server/include/readerWriter/writer/writer.h | 2 +- logger_service/server/include/ss_logger_cfg.h | 29 ++- logger_service/server/include/ss_logger_common.h | 6 +- .../server/include/ss_logger_device_detection.h | 2 +- .../server/include/ss_logger_error_event.h | 2 +- .../server/include/ss_logger_error_event_archive.h | 2 +- .../include/ss_logger_error_event_can_evt_reply.h | 2 +- .../server/include/ss_logger_error_event_cfg.h | 9 +- .../server/include/ss_logger_error_event_storage.h | 4 +- .../server/include/ss_logger_fs_directory.h | 2 +- logger_service/server/include/ss_logger_popups.h | 2 +- .../include/ss_logger_reader_writer_control.h | 2 +- logger_service/server/include/ss_logger_scrshot.h | 8 +- .../server/include/ss_logger_service_callbacks.h | 2 +- logger_service/server/include/ss_logger_types.h | 2 +- logger_service/server/include/ss_logger_util.h | 2 +- logger_service/server/lib/Makefile | 2 +- logger_service/server/lib/ss_logger_store_logs.cpp | 171 ++++++-------- .../lib/ss_logger_store_logs_loggerservicelog.h | 2 +- logger_service/server/realtimeUsbLog/Makefile | 2 +- logger_service/server/realtimeUsbLog/src/Makefile | 7 +- .../realtimeUsbLog/src/loggerservice_main.cpp | 2 +- .../realtimeUsbLog/src/ss_logger_realtime_usb.cpp | 2 +- logger_service/server/realtimeUsbLog/work/Makefile | 2 +- .../server/realtimeUsbLog/work_debug/Makefile | 2 +- logger_service/server/screenShot/Makefile | 3 +- .../server/screenShot/ss_logger_scrshot.cpp | 2 +- logger_service/server/src/cached_file_writer.cpp | 2 +- logger_service/server/src/file_writer.cpp | 2 +- .../server/src/loggerservice_application.cpp | 247 ++------------------- logger_service/server/src/loggerservice_main.cpp | 2 +- .../server/src/loggerservicedebug_child_thread.cpp | 2 +- .../src/loggerservicedebug_writer_Evntworker.cpp | 8 +- logger_service/server/src/mem_reader.cpp | 2 +- logger_service/server/src/mod_version.c | 2 +- logger_service/server/src/queue_reader.cpp | 2 +- logger_service/server/src/reader.cpp | 2 +- logger_service/server/src/reader_writer.cpp | 2 +- logger_service/server/src/ss_logger_cfg.cpp | 65 +++++- .../server/src/ss_logger_device_detection.cpp | 2 +- .../server/src/ss_logger_error_event.cpp | 58 ++--- .../server/src/ss_logger_error_event_archive.cpp | 2 +- .../src/ss_logger_error_event_can_evt_reply.cpp | 98 ++++---- .../server/src/ss_logger_error_event_cfg.cpp | 149 ++++++------- .../server/src/ss_logger_error_event_responses.cpp | 155 +------------ .../server/src/ss_logger_error_event_storage.cpp | 6 +- .../server/src/ss_logger_fs_directory.cpp | 2 +- logger_service/server/src/ss_logger_popups.cpp | 2 +- .../server/src/ss_logger_reader_writer_control.cpp | 2 +- .../server/src/ss_logger_server_callbacks.cpp | 2 +- logger_service/server/src/ss_logger_util.cpp | 10 +- logger_service/server/src/udp_file_writer.cpp | 2 +- logger_service/server/src/udp_writer.cpp | 2 +- logger_service/server/src/writer.cpp | 2 +- logger_service/server/work/Makefile | 10 +- 70 files changed, 404 insertions(+), 761 deletions(-) delete mode 100644 logger_service/server/cfg/logrotate.conf delete mode 100644 logger_service/server/cfg/syslog.conf (limited to 'logger_service/server') diff --git a/logger_service/server/Makefile b/logger_service/server/Makefile index 8c5c4871..5292a18f 100644 --- a/logger_service/server/Makefile +++ b/logger_service/server/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,14 +20,9 @@ SUBDIRS += realtimeUsbLog all: -install-data:install_cfg - -install_cfg: - install -d -m 775 $(DESTDIR)/usr/agl/conf/syslogd - install -m 644 -t $(DESTDIR)/usr/agl/conf/syslogd cfg/syslog.conf - install -d -m 775 $(DESTDIR)/usr/agl/share/logrotate - install -m 644 -t $(DESTDIR)/usr/agl/share/logrotate cfg/logrotate.conf - +install-data:install_data +install_data: + install -d -m 755 $(DESTDIR)/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog include ../../system_service.mk diff --git a/logger_service/server/cfg/logrotate.conf b/logger_service/server/cfg/logrotate.conf deleted file mode 100644 index b7daffc3..00000000 --- a/logger_service/server/cfg/logrotate.conf +++ /dev/null @@ -1,7 +0,0 @@ -# /etc/logrotate.conf - Configuration file for logrotate(8) -/ramd/log/frameworkunifiedlog/syslog/syslog.log { -maxsize 200K -size 200K -rotate 1 -create -} diff --git a/logger_service/server/cfg/syslog.conf b/logger_service/server/cfg/syslog.conf deleted file mode 100644 index 097ebabf..00000000 --- a/logger_service/server/cfg/syslog.conf +++ /dev/null @@ -1,4 +0,0 @@ -# /etc/syslog.conf - Configuration file for syslogd(8) -#selector action -daemon,user,local0.* /ramd/log/frameworkunifiedlog/syslog/syslog.log - diff --git a/logger_service/server/include/loggerservicedebug_loggerservicelog.h b/logger_service/server/include/loggerservicedebug_loggerservicelog.h index 1564fb5d..5a2f56e8 100644 --- a/logger_service/server/include/loggerservicedebug_loggerservicelog.h +++ b/logger_service/server/include/loggerservicedebug_loggerservicelog.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/loggerservicedebug_thread_if.h b/logger_service/server/include/loggerservicedebug_thread_if.h index 8203a68f..8a435114 100644 --- a/logger_service/server/include/loggerservicedebug_thread_if.h +++ b/logger_service/server/include/loggerservicedebug_thread_if.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/loggerservicedebug_writer_Evntworker.h b/logger_service/server/include/loggerservicedebug_writer_Evntworker.h index 70dc1bea..cef5c183 100644 --- a/logger_service/server/include/loggerservicedebug_writer_Evntworker.h +++ b/logger_service/server/include/loggerservicedebug_writer_Evntworker.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/reader/mem_reader.h b/logger_service/server/include/readerWriter/reader/mem_reader.h index 4d37242d..a5c65ec0 100644 --- a/logger_service/server/include/readerWriter/reader/mem_reader.h +++ b/logger_service/server/include/readerWriter/reader/mem_reader.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/reader/queue_reader.h b/logger_service/server/include/readerWriter/reader/queue_reader.h index 3706d642..139796a7 100644 --- a/logger_service/server/include/readerWriter/reader/queue_reader.h +++ b/logger_service/server/include/readerWriter/reader/queue_reader.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/reader/reader.h b/logger_service/server/include/readerWriter/reader/reader.h index 269cd8aa..7b0141de 100644 --- a/logger_service/server/include/readerWriter/reader/reader.h +++ b/logger_service/server/include/readerWriter/reader/reader.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/reader_writer.h b/logger_service/server/include/readerWriter/reader_writer.h index 44c37bd4..b0754725 100644 --- a/logger_service/server/include/readerWriter/reader_writer.h +++ b/logger_service/server/include/readerWriter/reader_writer.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/reader_writer_cfg.h b/logger_service/server/include/readerWriter/reader_writer_cfg.h index bc6602b5..b39353bc 100644 --- a/logger_service/server/include/readerWriter/reader_writer_cfg.h +++ b/logger_service/server/include/readerWriter/reader_writer_cfg.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/writer/cached_file_writer.h b/logger_service/server/include/readerWriter/writer/cached_file_writer.h index 06d7bbce..ad286589 100644 --- a/logger_service/server/include/readerWriter/writer/cached_file_writer.h +++ b/logger_service/server/include/readerWriter/writer/cached_file_writer.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/writer/file_writer.h b/logger_service/server/include/readerWriter/writer/file_writer.h index 190232b5..caf81c9b 100644 --- a/logger_service/server/include/readerWriter/writer/file_writer.h +++ b/logger_service/server/include/readerWriter/writer/file_writer.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/writer/udp_file_writer.h b/logger_service/server/include/readerWriter/writer/udp_file_writer.h index 095ca352..65e58e0e 100644 --- a/logger_service/server/include/readerWriter/writer/udp_file_writer.h +++ b/logger_service/server/include/readerWriter/writer/udp_file_writer.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/writer/udp_writer.h b/logger_service/server/include/readerWriter/writer/udp_writer.h index 34923e82..cf0944ad 100644 --- a/logger_service/server/include/readerWriter/writer/udp_writer.h +++ b/logger_service/server/include/readerWriter/writer/udp_writer.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/readerWriter/writer/writer.h b/logger_service/server/include/readerWriter/writer/writer.h index d5a397f2..15d93aa6 100644 --- a/logger_service/server/include/readerWriter/writer/writer.h +++ b/logger_service/server/include/readerWriter/writer/writer.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_cfg.h b/logger_service/server/include/ss_logger_cfg.h index 3e8da800..93aaef95 100644 --- a/logger_service/server/include/ss_logger_cfg.h +++ b/logger_service/server/include/ss_logger_cfg.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,9 +73,21 @@ enum EInsertEventType { eInsertEventInvalid }; +struct ExternalLogInfo { + std::string dirname; + std::string path; + BOOL remove; +}; + +struct ExternalLogList { + SI_32 num; + SI_32 max; + ExternalLogInfo* p_info; +}; + class CLoggerCfg { public: - CLoggerCfg(void) noexcept; + CLoggerCfg(void); ~CLoggerCfg(void); EFrameworkunifiedStatus Initialize(HANDLE f_hApp); @@ -85,10 +97,9 @@ class CLoggerCfg { void Print(void); EFrameworkunifiedStatus SetLoggingParams(HANDLE f_hApp, - STLoggerSetParams f_stLoggerSetParams) noexcept; + STLoggerSetParams f_stLoggerSetParams); - EFrameworkunifiedStatus SetUDPLogging(HANDLE f_hApp, ELOGGER_STAT f_eUDPLoggingStatus) - noexcept; + EFrameworkunifiedStatus SetUDPLogging(HANDLE f_hApp, const ELOGGER_STAT f_eUDPLoggingStatus); EFrameworkunifiedStatus PersistLoggingParam(HANDLE f_hApp); std::string getEmmcOutputPath(void); @@ -107,8 +118,8 @@ class CLoggerCfg { EFrameworkunifiedStatus GetIncrementAndPersistUserInvokedCounter(HANDLE f_hApp, UI_32 &f_counter); // NOLINT (runtime/references) - EFrameworkunifiedStatus GetAndIncrementEmmcCounter(UI_32 &f_counter) noexcept; // NOLINT (runtime/references) - EFrameworkunifiedStatus RefreshEmmcCounter(UI_32 &f_counter) noexcept; // NOLINT (runtime/references) + EFrameworkunifiedStatus GetAndIncrementEmmcCounter(UI_32 &f_counter); // NOLINT (runtime/references) + EFrameworkunifiedStatus RefreshEmmcCounter(UI_32 &f_counter) const; // NOLINT (runtime/references) void ResetEmmcCounter(void); @@ -121,6 +132,7 @@ class CLoggerCfg { SI_32 m_emmcOutputNaviLogMax; SI_32 m_emmcOutputNaviLogNmlMax; SI_32 m_emmcOutputNaviLogErrMax; + ExternalLogList m_ExternalLogList; std::string m_emmcOutputPath; std::string m_emmcOutputNaviLogPath; @@ -141,9 +153,10 @@ class CLoggerCfg { EFrameworkunifiedStatus GetLoggerStorageInfo(SLoggerStorageInfo &f_info); // NOLINT (runtime/references) BOOL IsLoggingEnabled(void); EFrameworkunifiedStatus EelActivateLogging(HANDLE f_hApp); + ExternalLogList GetExternalLogList(void); private: - void UpdateLoggingStatus(void) noexcept; + void UpdateLoggingStatus(void); std::vector m_LoggingCallBack; void GetHighestEmmcCounterValue(UI_32 &f_counter); // NOLINT (runtime/references) diff --git a/logger_service/server/include/ss_logger_common.h b/logger_service/server/include/ss_logger_common.h index 2cf5958e..80a56af7 100644 --- a/logger_service/server/include/ss_logger_common.h +++ b/logger_service/server/include/ss_logger_common.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ const CHAR PERFORMANCE_LOG_PATH_FN[] = "/tmp/frameworkunified_performance.log"; const CHAR DRINITIAL_LOG_PATH_FN[] = "/tmp/loggerservice_drinitial.log"; const CHAR DRLOCATION_LOG_PATH_FN[] = "/tmp/loggerservice_drlocation.log"; const CHAR KERNEL_LOG_PATH_FN[] = "/tmp/kernel.log"; -const CHAR KERNEL_BOOT_LOG_PATH_FN[] = "/ramd/log/frameworkunifiedlog/kernelboot.log"; +const CHAR KERNEL_BOOT_LOG_PATH_FN[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/kernelboot.log"; const UI_32 PERFORMANCELOG_FILE_SZ = 256 * 1024; -#define CLEAR_LOG_PATH_FN "/nv/log/frameworkunifiedlog/" +#define CLEAR_LOG_PATH_FN "/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog/" #define NULLCHAR '\0' #define DEBUG_USB_PATH "/mnt/sda1" diff --git a/logger_service/server/include/ss_logger_device_detection.h b/logger_service/server/include/ss_logger_device_detection.h index 0522c9ea..5ee67c0e 100644 --- a/logger_service/server/include/ss_logger_device_detection.h +++ b/logger_service/server/include/ss_logger_device_detection.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_error_event.h b/logger_service/server/include/ss_logger_error_event.h index 80b6bd8a..177c0745 100644 --- a/logger_service/server/include/ss_logger_error_event.h +++ b/logger_service/server/include/ss_logger_error_event.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_error_event_archive.h b/logger_service/server/include/ss_logger_error_event_archive.h index feaba965..2b5212dc 100644 --- a/logger_service/server/include/ss_logger_error_event_archive.h +++ b/logger_service/server/include/ss_logger_error_event_archive.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_error_event_can_evt_reply.h b/logger_service/server/include/ss_logger_error_event_can_evt_reply.h index 7ebb6ec4..b976cdbb 100644 --- a/logger_service/server/include/ss_logger_error_event_can_evt_reply.h +++ b/logger_service/server/include/ss_logger_error_event_can_evt_reply.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_error_event_cfg.h b/logger_service/server/include/ss_logger_error_event_cfg.h index b9b13094..1a0e39ef 100644 --- a/logger_service/server/include/ss_logger_error_event_cfg.h +++ b/logger_service/server/include/ss_logger_error_event_cfg.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ #include #include +#include "ss_logger_cfg.h" + typedef UI_32 ARTIFACT_BIT_MASK; typedef UI_32 EVENT_BIT_MASK; @@ -114,16 +116,17 @@ class CErrorEventCfg { ~CErrorEventCfg(void); - EFrameworkunifiedStatus Initialize(void); + EFrameworkunifiedStatus Initialize(CLoggerCfg* p_logger_cfg); void GetArtifactRequestVec( EErrorEventType f_eventType, std::vector &f_refArtifactRequestVec); // NOLINT (runtime/references) EVENT_BIT_MASK GetEventsForErrorEvent(EErrorEventType f_eventType); private: - UI_32 ValidateConfiguration(void); + UI_32 ValidateConfiguration(); TArtifactBitMaskMap m_errorEventTypeToArtifactBitMaskMap; TArtifactMap m_errorArtifactMap; + UI_32 m_ext_log_num; static TLoggingArtifactCfg m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue]; static TLoggingArtifact m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue]; diff --git a/logger_service/server/include/ss_logger_error_event_storage.h b/logger_service/server/include/ss_logger_error_event_storage.h index e5620e81..8a2cbd46 100644 --- a/logger_service/server/include/ss_logger_error_event_storage.h +++ b/logger_service/server/include/ss_logger_error_event_storage.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ #include #include #include -//#include +#include #include #include "ss_logger_cfg.h" diff --git a/logger_service/server/include/ss_logger_fs_directory.h b/logger_service/server/include/ss_logger_fs_directory.h index 9006f5fa..7e8da15c 100644 --- a/logger_service/server/include/ss_logger_fs_directory.h +++ b/logger_service/server/include/ss_logger_fs_directory.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_popups.h b/logger_service/server/include/ss_logger_popups.h index d45459df..b5b50e89 100644 --- a/logger_service/server/include/ss_logger_popups.h +++ b/logger_service/server/include/ss_logger_popups.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_reader_writer_control.h b/logger_service/server/include/ss_logger_reader_writer_control.h index 4587ac7b..04d19374 100644 --- a/logger_service/server/include/ss_logger_reader_writer_control.h +++ b/logger_service/server/include/ss_logger_reader_writer_control.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_scrshot.h b/logger_service/server/include/ss_logger_scrshot.h index a9e1b311..5cc9dd9b 100644 --- a/logger_service/server/include/ss_logger_scrshot.h +++ b/logger_service/server/include/ss_logger_scrshot.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,9 @@ #ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_ #define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_ -#define JPEG_PATH_CH0 "/nv/log/work/screenShot/screen_shot_Ch0.jpeg" -#define JPEG_PATH_CH1 "/nv/log/work/screenShot/screen_shot_Ch1.jpeg" +#define JPEG_PATH_CH0 "/nv/BS/ss/logger_service/rwdata/screenShot/screen_shot_Ch0.jpeg" +#define JPEG_PATH_CH1 "/nv/BS/ss/logger_service/rwdata/screenShot/screen_shot_Ch1.jpeg" #define SCRSHOT_EXE_PATH "/usr/agl/bin/SS_ScrShot" -#define SCREEN_SHOT_PATH "/nv/log/work/screenShot" +#define SCREEN_SHOT_PATH "/nv/BS/ss/logger_service/rwdata/screenShot" #endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_ diff --git a/logger_service/server/include/ss_logger_service_callbacks.h b/logger_service/server/include/ss_logger_service_callbacks.h index c466ee11..786054c3 100644 --- a/logger_service/server/include/ss_logger_service_callbacks.h +++ b/logger_service/server/include/ss_logger_service_callbacks.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_types.h b/logger_service/server/include/ss_logger_types.h index dba34e99..11542a58 100644 --- a/logger_service/server/include/ss_logger_types.h +++ b/logger_service/server/include/ss_logger_types.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/include/ss_logger_util.h b/logger_service/server/include/ss_logger_util.h index a5d83c53..a49e0229 100644 --- a/logger_service/server/include/ss_logger_util.h +++ b/logger_service/server/include/ss_logger_util.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/lib/Makefile b/logger_service/server/lib/Makefile index 113a7a4f..fff8c365 100644 --- a/logger_service/server/lib/Makefile +++ b/logger_service/server/lib/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/logger_service/server/lib/ss_logger_store_logs.cpp b/logger_service/server/lib/ss_logger_store_logs.cpp index d54ca9c2..2bd8b79f 100644 --- a/logger_service/server/lib/ss_logger_store_logs.cpp +++ b/logger_service/server/lib/ss_logger_store_logs.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,29 +42,22 @@ #include #include #include -//#include +#include #include #include #include #include #include #include "ss_logger_store_logs_loggerservicelog.h" +#include "ss_logger_cfg.h" -#define LOGGERSERVICELOG_CONFIG_PATH "/usr/agl/share/systemmanager/scfg/ss_logger.cfg" +#define LOGGERSERVICELOG_CONFIG_PATH "/usr/agl/conf/BS/ss/logger_service/rodata/ss_logger.cfg" #define LOGGER_TMP_FN "__LOGGER.tmp" #define LOGGERSERVICELOG_TMP_OUTPUT_PATH "/tmp" #define PSTORE_DIR_PATH "/dev/pstore" #define KERNEL_BOOT_LOG_FN "kernelboot.log" #define KERNEL_LOG_FN "kernel.log" -#define CONNECTIVITY_DIR_NAME "connectivity" #define COMMUNICATION_DIR_NAME "communication" -#define RADIO_DIR_NAME "radio" -#define GRAPHICS_FN_LOG_FN "graphics.log" -#define SYSLOG_DIR_NAME "syslog" -#define WINSYS_LOG_FN "winsys.log" -#define APPFW_DIR_NAME "appfw" -#define TOMOYO_DIR_PATH "/nv/ptdata/sec" -#define TOMOYO_DIR_NAME "tomoyo" #define ACCOFFON_DIR_NAME "accoffon" #define PATHNAME_SEPARATOR '/' @@ -97,6 +90,8 @@ typedef struct { std::string output_path; SI_32 output_max; SI_32 output_errmax; + SI_32 external_log_num; + SI_32 external_log_max; } CfgInfo; typedef struct { @@ -154,21 +149,9 @@ static void getLastKernelLog(std::vector& list); // NOLINT (runtime/re static void getKernelLog(std::vector& list); // NOLINT (runtime/references) static void getKernelBootLog(SS_STORELOGS_OPE_TYPE type, std::vector& list); // NOLINT (runtime/references) -static void getConnectivitylogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list); // NOLINT (runtime/references) -static void getRadiologFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list); // NOLINT (runtime/references) static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type, std::vector& list); // NOLINT (runtime/references) -static void getGraphicslogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list); // NOLINT (runtime/references) -static void getSyslogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list); // NOLINT (runtime/references) -static void getWinSyslogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list); // NOLINT (runtime/references) -static void getAppFwlogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list); // NOLINT (runtime/references) -static void getTomoyologFile(SS_STORELOGS_OPE_TYPE type, +static void getExternallogFile(SS_STORELOGS_OPE_TYPE type, std::vector& list); // NOLINT (runtime/references) //static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references) @@ -216,9 +199,8 @@ static std::string m_pathAndName; // NOLINT (runtime/string) static std::string m_tmpName; // NOLINT (runtime/string) const GetLogFileFunc GetLogFuncTbl[] = { getKernellogFile, - getConnectivitylogFile, getRadiologFile, getCommunicationlogFile, - getGraphicslogFile, getSyslogFile, getWinSyslogFile, getAppFwlogFile, - getTomoyologFile + getCommunicationlogFile, + getExternallogFile }; // GZF save variables static gzFile g_gztype; @@ -1415,32 +1397,6 @@ static EFrameworkunifiedStatus storeLogs(SS_STORELOGS_OPE_TYPE type) { return (l_eFrameworkunifiedStatus); } -static void getConnectivitylogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) - - LogInfo log_info; - - log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(CONNECTIVITY_DIR_NAME); - log_info.dest_name = CONNECTIVITY_DIR_NAME; - log_info.tmp_file_delete = FALSE; - list.push_back(log_info); -} - -static void getRadiologFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) - - LogInfo log_info; - - log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(RADIO_DIR_NAME); - log_info.dest_name = RADIO_DIR_NAME; - log_info.tmp_file_delete = FALSE; - list.push_back(log_info); -} - static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type, std::vector& list) { // NOLINT (runtime/references) @@ -1454,68 +1410,75 @@ static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type, list.push_back(log_info); } -static void getGraphicslogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) - LogInfo log_info; - - log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(GRAPHICS_FN_LOG_FN); - log_info.dest_name = GRAPHICS_FN_LOG_FN; - log_info.tmp_file_delete = FALSE; - list.push_back(log_info); -} - -static void getSyslogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) - LogInfo log_info; +static void getExternallogFile(SS_STORELOGS_OPE_TYPE type, + std::vector& list) { // NOLINT (runtime/references) + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + ExternalLogList ext_log; + memset(&ext_log, 0, sizeof(&ext_log)); - log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(SYSLOG_DIR_NAME); - log_info.dest_name = SYSLOG_DIR_NAME; - log_info.tmp_file_delete = FALSE; - list.push_back(log_info); -} + CNSConfigReader *l_pReaderCfg = new CNSConfigReader(); -static void getWinSyslogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) + if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5: new's error case + // LCOV_EXCL_START 5: new's error case + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unable to allocate CNSConfigReader object."); + // LCOV_EXCL_STOP + } else { + if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(LOGGERSERVICELOG_CONFIG_PATH))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->Parse(%s) returned: 0x%X", LOGGERSERVICELOG_CONFIG_PATH); + } else if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogNum", ext_log.num))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetInt(LOGGING.ExternalLogNum)"); + } else if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogMax", ext_log.max))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputMax)"); + } else { + if (ext_log.num > 0) { + std::string str = "EXTERNAL_"; + UI_32 num = 0; - LogInfo log_info; + if (ext_log.num <= ext_log.max) { + num = ext_log.num; + } else { + num = ext_log.max; + } - log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(WINSYS_LOG_FN); - log_info.dest_name = WINSYS_LOG_FN; - log_info.tmp_file_delete = FALSE; - list.push_back(log_info); -} + ext_log.p_info = new ExternalLogInfo[num]; + + // Load external log info + for (UI_32 i = 0; i < num; i++) { + std::string query = str + std::to_string(i+1); + if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetString((query+".OutputPath"), ext_log.p_info[i].dirname))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetString(EXTERNAL.OutputPath)"); + } else if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetString((query+".ExtLogPath"), ext_log.p_info[i].path))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetString(EXTERNAL.ExtLogPath)"); + } else if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetBool((query+".Remove"), ext_log.p_info[i].remove))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetBool(EXTERNAL.Remove)"); + } else { + LogInfo log_info; + log_info.file_path = ext_log.p_info[i].path; + log_info.dest_name = ext_log.p_info[i].dirname; + log_info.tmp_file_delete = ext_log.p_info[i].remove; -static void getAppFwlogFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) + list.push_back(log_info); + } + } - LogInfo log_info; + delete[] ext_log.p_info; - log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(APPFW_DIR_NAME); - log_info.dest_name = APPFW_DIR_NAME; - log_info.tmp_file_delete = FALSE; - list.push_back(log_info); + } else { + // None external log + } + } + delete l_pReaderCfg; + } } -static void getTomoyologFile(SS_STORELOGS_OPE_TYPE type, - std::vector& list) { // NOLINT (runtime/references) - LogInfo log_info; - log_info.file_path = TOMOYO_DIR_PATH; - log_info.file_path.append("/"); - log_info.file_path.append(TOMOYO_DIR_NAME); - log_info.dest_name = TOMOYO_DIR_NAME; - log_info.tmp_file_delete = TRUE; - list.push_back(log_info); -} static void getLoggerservicelogFile(SS_STORELOGS_OPE_TYPE type, std::vector& list, // NOLINT (runtime/references) diff --git a/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h b/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h index 1d2880bd..31d1caad 100644 --- a/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h +++ b/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/realtimeUsbLog/Makefile b/logger_service/server/realtimeUsbLog/Makefile index 2cd5901d..420c13e0 100644 --- a/logger_service/server/realtimeUsbLog/Makefile +++ b/logger_service/server/realtimeUsbLog/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/logger_service/server/realtimeUsbLog/src/Makefile b/logger_service/server/realtimeUsbLog/src/Makefile index bdeae32b..c3733b3a 100644 --- a/logger_service/server/realtimeUsbLog/src/Makefile +++ b/logger_service/server/realtimeUsbLog/src/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,7 +44,6 @@ CPPFLAGS += -I../../../../system_manager/server/include/processlauncher ######### add compile option ############# CPPFLAGS += -DLINUX -CXXFLAGS += -std=c++11 CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30 ######### linked library ############# @@ -59,15 +58,13 @@ LDLIBS += -Wl,-Bdynamic -lstdc++ LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy LDLIBS += -Wl,-Bdynamic -lsssmcfg -#LDLIBS += -Wl,-Bdynamic -lMounter LDLIBS += -Wl,-Bdynamic -lresm LDLIBS += -Wl,-Bdynamic -lssver LDLIBS += -Wl,-Bdynamic -lSS_RomAccessIf #LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI -LDLIBS += -Wl,-Bdynamic -lvp LDLIBS += -Wl,-Bdynamic -ltar -lz LDLIBS += -Wl,-Bdynamic -lrt -LDLIBS += -Wl,-Bdynamic -lvp + ######### add library path ############# diff --git a/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp b/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp index b9ca02c9..d5dfd00c 100644 --- a/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp +++ b/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp b/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp index 9499a555..c318f1ac 100644 --- a/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp +++ b/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/realtimeUsbLog/work/Makefile b/logger_service/server/realtimeUsbLog/work/Makefile index 61a53ddf..ee9c7e8a 100644 --- a/logger_service/server/realtimeUsbLog/work/Makefile +++ b/logger_service/server/realtimeUsbLog/work/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/logger_service/server/realtimeUsbLog/work_debug/Makefile b/logger_service/server/realtimeUsbLog/work_debug/Makefile index 5654d9df..8ad806a2 100644 --- a/logger_service/server/realtimeUsbLog/work_debug/Makefile +++ b/logger_service/server/realtimeUsbLog/work_debug/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/logger_service/server/screenShot/Makefile b/logger_service/server/screenShot/Makefile index 8f801231..f52e40c0 100644 --- a/logger_service/server/screenShot/Makefile +++ b/logger_service/server/screenShot/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,7 +43,6 @@ CPPFLAGS += -fno-exceptions LDLIBS += -Wl,-Bdynamic -ldu LDLIBS += -Wl,-Bdynamic -ljpeg #LDLIBS += -Wl,-Bdynamic -lextension -LDLIBS += -Wl,-Bdynamic -lvp LDLIBS += -Wl,-Bdynamic -ldrm ######### add library path ############# diff --git a/logger_service/server/screenShot/ss_logger_scrshot.cpp b/logger_service/server/screenShot/ss_logger_scrshot.cpp index d45b212e..db5bcba9 100644 --- a/logger_service/server/screenShot/ss_logger_scrshot.cpp +++ b/logger_service/server/screenShot/ss_logger_scrshot.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/cached_file_writer.cpp b/logger_service/server/src/cached_file_writer.cpp index e7d392e5..92c02f5a 100644 --- a/logger_service/server/src/cached_file_writer.cpp +++ b/logger_service/server/src/cached_file_writer.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/file_writer.cpp b/logger_service/server/src/file_writer.cpp index 7d7fb8b2..221a1d4d 100644 --- a/logger_service/server/src/file_writer.cpp +++ b/logger_service/server/src/file_writer.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/loggerservice_application.cpp b/logger_service/server/src/loggerservice_application.cpp index d67ee088..2d39fb2e 100644 --- a/logger_service/server/src/loggerservice_application.cpp +++ b/logger_service/server/src/loggerservice_application.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,6 @@ #include -#include #include #include #include @@ -61,7 +60,7 @@ #include #include #include -//#include +#include #include #include #include @@ -103,9 +102,7 @@ CErrorEvent g_errorEventHandler; CLoggerServiceCallbacks g_serviceCallbacks; CLoggerDeviceDetection g_deviceDetection; CReaderWriterControl g_ReaderWriterControl; -//CPFDRECThread g_PFDRECThread; -TimerCtrl* g_pLRotateTimer = NULL; -uint32_t g_iLRotateCmd; +CPFDRECThread g_PFDRECThread; /// Decide the function NormalStartupProcess execution static bool g_normal_startup_status = false; @@ -181,7 +178,7 @@ EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) { LOG_STATUS_IF_ERRORED(l_eStatus, "g_loggerCfg.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro std::string l_cfgFilePathAndName = - "/usr/agl/share/systemmanager/scfg/ss_logger.cfg"; + "/usr/agl/conf/BS/ss/logger_service/rodata/ss_logger.cfg"; if (eFrameworkunifiedStatusOK != (l_eStatus = g_loggerCfg.Load(l_cfgFilePathAndName))) { // LCOV_EXCL_BR_LINE 200:To ensure success // LCOV_EXCL_START 200:To ensure success AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert @@ -284,8 +281,8 @@ EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) { l_eStatus = RegisterSMSessionAckCallback(SMSessionAckCb); // LCOV_EXCL_BR_LINE 11:Unexpected branch LOG_STATUS_IF_ERRORED(l_eStatus, "RegisterSMSessionAckCallback()"); // LCOV_EXCL_BR_LINE 15: macro -// l_eStatus = g_PFDRECThread.Initialize(hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch -// LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro + l_eStatus = g_PFDRECThread.Initialize(hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro // Publish Service available this can also be published from FrameworkunifiedOnStart callback if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) { // LCOV_EXCL_BR_LINE 4:NSFW @@ -306,205 +303,6 @@ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_SSServi return (l_eStatus); } -// lotate interval -#define LOGROTATE_INTERVAL_TIME 60 -// Get syslog file size -static off_t syslog_fsize(void) { - struct stat stat_buf; - - if (stat("/ramd/log/frameworkunifiedlog/syslog/syslog.log", &stat_buf) < 0) - return 0; - - return stat_buf.st_size; -} - -// Send SIGHUP to syslogd for restart syslogd. -static EFrameworkunifiedStatus SendSigHupToSyslogd(void) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - int fd = open("/var/run/syslogd.pid", O_RDONLY); - - if (fd != -1) { // LCOV_EXCL_BR_LINE 200:Depends on the actual syslogd - // LCOV_EXCL_START 200:Depends on the actual syslogd - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - char buf[32]; - ssize_t rsize; - long int pid; // NOLINT (runtime/int) - char *endptr; - rsize = read(fd, buf, sizeof(buf) - 1); - if (rsize != -1) { - buf[rsize] = 0; - pid = strtol(buf, &endptr, 10); - if (kill(static_cast(pid), SIGHUP) == -1) { - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - "Error SIGHUP syslogd(pid:%ld) %s: log rotation", pid, - strerror(errno)); - } - } else { - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "read:no:%d,msg:%s", errno, - strerror(errno)); - } - close(fd); - // LCOV_EXCL_STOP - } else { - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "open:no:%d,msg:%s", errno, - strerror(errno)); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -// Rotate LogFile -static EFrameworkunifiedStatus OnRotationLog(HANDLE hApp) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - pid_t pid; - off_t old_logfsize, new_logfsize; - CL_ProcessAttr_t clAttr; - char *args[] = { const_cast("/usr/sbin/logrotate"), - const_cast("--state=/ramd/log/frameworkunifiedlog/syslog/logrotate.status"), - const_cast("/usr/agl/share/logrotate/logrotate.conf"), NULL }; - - old_logfsize = syslog_fsize(); - - if (CL_ProcessCreateAttrInit(&clAttr) != 0) { // LCOV_EXCL_BR_LINE 200:Because the clAttr is never NULL, it will always succeed - // LCOV_EXCL_START 200:Because the clAttr is never NULL, it will always succeed - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreateAttrInit"); - return eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP - } - if (CL_ProcessCreateAttrSetGroup(&clAttr, 1) != 0) { // LCOV_EXCL_BR_LINE 200:To ensure success - // LCOV_EXCL_START 200:To ensure success - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreateAttrSetGroup"); - return eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP - } - - pid = CL_ProcessCreate(args[0], args, NULL, &clAttr); - if (pid == -1) { // LCOV_EXCL_BR_LINE 200:To ensure success - // LCOV_EXCL_START 200:To ensure success - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreate"); - return eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP - } - - fd_set fds; - struct timeval tv; - int selection; - do { - tv.tv_sec = 3; - tv.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(g_errorEventHandler.m_sfd, &fds); - selection = select(g_errorEventHandler.m_sfd + 1, &fds, NULL, NULL, &tv); - } while ((selection < 0) && (errno == EINTR)); // LCOV_EXCL_BR_LINE 5:c function error - - if (selection < 0) { // LCOV_EXCL_BR_LINE 5:c function error - // LCOV_EXCL_START 5:c function error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Select:selection:%d,no:%d,msg:%s", - selection, errno, strerror(errno)); - // LCOV_EXCL_STOP - } else { - if (FD_ISSET(g_errorEventHandler.m_sfd, &fds)) { // LCOV_EXCL_BR_LINE 5:c function error - int ret = 0; - do { - CL_ProcessCleanupInfo_t cinfo; - - ret = CL_ProcessCleanup(g_errorEventHandler.m_sfd, &cinfo); - - if ((ret != -1) && (cinfo.code == CLD_EXITED)) { - if (cinfo.status != 0) { // LCOV_EXCL_BR_LINE 5:c function error(waitid in CL_ProcessCleanup) - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCleanup:status:%d", - cinfo.status); - } - } else if (ret == -1) { // LCOV_EXCL_BR_LINE 5:c function error - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCleanup:no:%d,msg:%s", - errno, strerror(errno)); - } - } while (ret == 1); // // LCOV_EXCL_BR_LINE 4: CL_ProcessCleanup will not return 1 - } else { - // LCOV_EXCL_START 5:c function error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FD_ISSET"); - // LCOV_EXCL_STOP - } - } - - new_logfsize = syslog_fsize(); - if (new_logfsize < old_logfsize) { - // in case of logfile rotated, send SIGHUP to syslogd for restart. - l_eStatus = SendSigHupToSyslogd(); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -// timer fd max -#define LOGROTATE_TIMER_SET_MAX 1 - -// Start logrotate -static EFrameworkunifiedStatus StartLogrotate(HANDLE hApp) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - // cleanup - if (unlink("/ramd/log/frameworkunifiedlog/syslog/logrotate.status") == -1) { - // nop - } - - if (g_pLRotateTimer == NULL) { // LCOV_EXCL_BR_LINE 200: As it is always NULL at startup - g_pLRotateTimer = new TimerCtrl(LOGROTATE_TIMER_SET_MAX); - if (g_pLRotateTimer == NULL) { // LCOV_EXCL_BR_LINE 5: new error - // LCOV_EXCL_START 5: new error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 5: new error - l_eStatus = eFrameworkunifiedStatusNullPointer; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerCreate failed."); - // LCOV_EXCL_STOP - } else { - // Start Rotate Timer - g_pLRotateTimer->Initialize(hApp); - g_iLRotateCmd = g_pLRotateTimer->CreateTimer(OnRotationLog); - g_pLRotateTimer->StartTimer(g_iLRotateCmd, LOGROTATE_INTERVAL_TIME, 0, - LOGROTATE_INTERVAL_TIME, 0); - } - } else { - // LCOV_EXCL_START 200: As it is always NULL at startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_eStatus = eFrameworkunifiedStatusFail; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Timer already exists."); - // LCOV_EXCL_STOP - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -// Stop logrotate -static EFrameworkunifiedStatus StopLogrotate(HANDLE hApp) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (g_pLRotateTimer != NULL) { // LCOV_EXCL_BR_LINE 6: dead code - // Stop Rotate Timer - g_pLRotateTimer->DeleteTimer(g_iLRotateCmd); - delete g_pLRotateTimer; - g_pLRotateTimer = NULL; - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - static void *accOffOnCollect(void* param) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); SS_LoggerStoreLogs(SS_STORELOGS_ACCOFFON_PRESS); @@ -519,15 +317,16 @@ static EFrameworkunifiedStatus NormalStartupProcess(HANDLE hApp) { EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; if (false == g_normal_startup_status) { - LBM_RAM_t p_info; - l_eStatus = GetBootLoaderInfoRequestToSystemManager(&p_info); - if (l_eStatus != eFrameworkunifiedStatusOK) { - AGL_ASSERT_NOT_TESTED(); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, " Error. GetBootLoaderInfo = %d", l_eStatus); - } else if (p_info.syscomSts == SUBCPU_STS_COMNG) { - AGL_ASSERT_NOT_TESTED(); - HANDLE timer; - timer = FrameworkunifiedAttachTimerCallback(hApp, SYS_ILLEGAL_LOG_DELAY_TIME, 0, SysIllegalLogTimer_OnInterval); + T_SS_SM_START_DataStructType prm; + + l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &prm, sizeof(T_SS_SM_START_DataStructType), eSMRRetain); + if (eFrameworkunifiedStatusOK != l_eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Failed PasGetMsgDataOfSize() [%d]", l_eStatus); + } + + if (prm.resetStatus == e_SS_SM_RESET_STATUS_NG) { + HANDLE timer = + FrameworkunifiedAttachTimerCallback(hApp, SYS_ILLEGAL_LOG_DELAY_TIME, 0, SysIllegalLogTimer_OnInterval); if (timer == NULL) { FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, " Failed to register timer."); } @@ -539,7 +338,6 @@ static EFrameworkunifiedStatus NormalStartupProcess(HANDLE hApp) { } if (g_eLoggerServiceStatus == eLSStop) { - AGL_ASSERT_NOT_TESTED(); // Publish Service available this can also be published from FrameworkunifiedOnStart callback if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) { @@ -548,7 +346,7 @@ static EFrameworkunifiedStatus NormalStartupProcess(HANDLE hApp) { l_eStatus); } - /// Start the Writer threads + // Start the Writer threads if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, g_thrdEvntLogWriter, sizeof(Evntlog_wi), &Evntlog_wi))) { @@ -559,9 +357,6 @@ static EFrameworkunifiedStatus NormalStartupProcess(HANDLE hApp) { // Set Service status to init g_eLoggerServiceStatus = eLSStart; - // Start logrotate - StartLogrotate(hApp); - // Set normal_startup_status flag (true) g_normal_startup_status = true; } @@ -690,7 +485,6 @@ EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) { } else { EFrameworkunifiedStatus loggerserviceRet = SS_LoggerStoreLogs(SS_STORELOGS_INTERFACEUNIFIEDLOG); LOG_STATUS_IF_ERRORED(loggerserviceRet, "Fail to save Loggerservice Log"); - EFrameworkunifiedStatus naviLog_status = g_errorEventHandler.SaveNaviLog( errorType.shutdownTrigger); LOG_STATUS_IF_ERRORED(naviLog_status, "Fail to save Navi Log"); @@ -1151,11 +945,8 @@ EFrameworkunifiedStatus cbServiceWakeupStatus(HANDLE hApp) { void StopLoggingFunction(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); // PFDRECThread Stop -// EFrameworkunifiedStatus l_eStatus = g_PFDRECThread.Finalize(hApp); -// LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Finalize()"); - - // Stop logrotate - StopLogrotate(hApp); + EFrameworkunifiedStatus l_eStatus = g_PFDRECThread.Finalize(hApp); + LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Finalize()"); FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); } diff --git a/logger_service/server/src/loggerservice_main.cpp b/logger_service/server/src/loggerservice_main.cpp index 334d73de..a7ee2124 100644 --- a/logger_service/server/src/loggerservice_main.cpp +++ b/logger_service/server/src/loggerservice_main.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/loggerservicedebug_child_thread.cpp b/logger_service/server/src/loggerservicedebug_child_thread.cpp index beb4ea3f..4a8668f0 100644 --- a/logger_service/server/src/loggerservicedebug_child_thread.cpp +++ b/logger_service/server/src/loggerservicedebug_child_thread.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp b/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp index 5c2ecb0a..5d29a58e 100644 --- a/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp +++ b/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ #include #include #include -//#include +#include #include #include #include @@ -934,8 +934,8 @@ PSTR _GetCurrentTimeString(PCHAR TempFileName, PSTR f_pstrVIN) { // LCOV_EXCL_ST std::string l_strVIN = f_pstrVIN; // Time string is based on current date and time. Time string format is . -// Clock_getSystemTimeY2K38(&rawtime, &status); -// Clock_getLocalTimeY2K38(&rawtime, &local_time); + Clock_getSystemTimeY2K38(&rawtime, &status); + Clock_getLocalTimeY2K38(&rawtime, &local_time); if (0 != (l_len = static_cast(strftime(tbuf, sizeof(tbuf), "%Y-%m-%dT%H%M", &local_time)))) { diff --git a/logger_service/server/src/mem_reader.cpp b/logger_service/server/src/mem_reader.cpp index 6d25d764..5ad6a6c3 100644 --- a/logger_service/server/src/mem_reader.cpp +++ b/logger_service/server/src/mem_reader.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/mod_version.c b/logger_service/server/src/mod_version.c index a484d10b..0594b74c 100644 --- a/logger_service/server/src/mod_version.c +++ b/logger_service/server/src/mod_version.c @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/queue_reader.cpp b/logger_service/server/src/queue_reader.cpp index 1c831544..6c056c36 100644 --- a/logger_service/server/src/queue_reader.cpp +++ b/logger_service/server/src/queue_reader.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/reader.cpp b/logger_service/server/src/reader.cpp index 4ceaf47b..04880f02 100644 --- a/logger_service/server/src/reader.cpp +++ b/logger_service/server/src/reader.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/reader_writer.cpp b/logger_service/server/src/reader_writer.cpp index df1cd9c3..ef32384f 100644 --- a/logger_service/server/src/reader_writer.cpp +++ b/logger_service/server/src/reader_writer.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_cfg.cpp b/logger_service/server/src/ss_logger_cfg.cpp index 6891792e..b353bbed 100644 --- a/logger_service/server/src/ss_logger_cfg.cpp +++ b/logger_service/server/src/ss_logger_cfg.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,8 +44,7 @@ const static UI_32 cMAX_EMMC_COUNTER_VALUE = 100000u; // NOLINT (build/storage_ /////////////////////////////////////////////////////////////////////////////// CLoggerCfg::CLoggerCfg() -noexcept : - m_logMaxFileSize(0), + : m_logMaxFileSize(0), m_performanceLogMaxFileSize(0), m_emmcOutputMax(0), m_emmcOutputErrMax(0), @@ -65,10 +64,16 @@ noexcept : m_eLoggerStatus(SS_LOGGER_DEFAULT_VALUE) { m_udpEnvFlag = FALSE; std::memset(m_logMask, 0, sizeof(m_logMask)); + std::memset(&m_ExternalLogList, 0, sizeof(&m_ExternalLogList)); } CLoggerCfg::~CLoggerCfg(void) { // LCOV_EXCL_START 14:global instance AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + + if (m_ExternalLogList.p_info != NULL) { + delete[] m_ExternalLogList.p_info; + m_ExternalLogList.p_info = NULL; + } } // LCOV_EXCL_STOP @@ -131,8 +136,7 @@ EFrameworkunifiedStatus CLoggerCfg::SetandPersistLoggingParams(HANDLE f_hApp, } EFrameworkunifiedStatus CLoggerCfg::SetLoggingParams(HANDLE f_hApp, - STLoggerSetParams f_stLoggerSetParams) - noexcept { + const STLoggerSetParams f_stLoggerSetParams) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; STLoggerSetAllParams l_Params; @@ -150,7 +154,7 @@ EFrameworkunifiedStatus CLoggerCfg::SetLoggingParams(HANDLE f_hApp, } EFrameworkunifiedStatus CLoggerCfg::SetUDPLogging(HANDLE f_hApp, - ELOGGER_STAT f_eUDPLoggingStatus) noexcept { + const ELOGGER_STAT f_eUDPLoggingStatus) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; STLoggerSetAllParams l_Params; @@ -309,6 +313,10 @@ EFrameworkunifiedStatus CLoggerCfg::Load(const std::string &f_filePathAndName) { AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.TimeoutAfter)"); // LCOV_EXCL_STOP + } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogNum", m_ExternalLogList.num))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length] + LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.ExternalLogNum)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length] + } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogMax", m_ExternalLogList.max))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length] + LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.ExternalLogMax)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length] } else { RemoveCarriageReturn(m_emmcOutputPath); RemoveCarriageReturn(m_emmcOutputNaviLogPath); @@ -340,6 +348,41 @@ EFrameworkunifiedStatus CLoggerCfg::Load(const std::string &f_filePathAndName) { m_EELActivateRelPath = "/EEL_activate"; m_LoggerserviceEmmcLogsRelPath = "/LOGGERSERVICE_EMMC_LOGS"; + if (m_ExternalLogList.num > 0) { + std::string str = "EXTERNAL_"; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others) + UI_32 num = 0; + + if (m_ExternalLogList.num <= m_ExternalLogList.max) { + num = m_ExternalLogList.num; + } else { + num = m_ExternalLogList.max; + } + + // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others) + m_ExternalLogList.p_info = new ExternalLogInfo[num]; + + // Load external log info + for (UI_32 i = 0; i < num; i++) { + std::string query = str + std::to_string(i+1); + if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetString((query+".OutputPath"), m_ExternalLogList.p_info[i].dirname))) { + LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(EXTERNAL.OutputPath)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length] + } else if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetString((query+".ExtLogPath"), m_ExternalLogList.p_info[i].path))) { + LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(EXTERNAL.ExtLogPath)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length] + } else if (eFrameworkunifiedStatusOK != + (l_eStatus = l_pReaderCfg->GetBool((query+".Remove"), m_ExternalLogList.p_info[i].remove))) { + LOG_STATUS(l_eStatus, "l_pReaderCfg->GetBool(EXTERNAL.Remove)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length] + } else { + RemoveCarriageReturn(m_ExternalLogList.p_info[i].dirname); + RemoveCarriageReturn(m_ExternalLogList.p_info[i].path); + } + } + // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others) + } else { + // None external log + } + if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Configuration successfully loaded."); // LCOV_EXCL_BR_LINE 15: macro @@ -510,7 +553,7 @@ EFrameworkunifiedStatus CLoggerCfg::GetIncrementAndPersistUserInvokedCounter( return (l_eStatus); } -EFrameworkunifiedStatus CLoggerCfg::GetAndIncrementEmmcCounter(UI_32 &f_counter) noexcept { +EFrameworkunifiedStatus CLoggerCfg::GetAndIncrementEmmcCounter(UI_32 &f_counter) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; std::string l_checkFileName; @@ -573,7 +616,7 @@ EFrameworkunifiedStatus CLoggerCfg::GetAndIncrementEmmcCounter(UI_32 &f_counter) return (l_eStatus); } -EFrameworkunifiedStatus CLoggerCfg::RefreshEmmcCounter(UI_32& f_counter) noexcept { +EFrameworkunifiedStatus CLoggerCfg::RefreshEmmcCounter(UI_32& f_counter) const { EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; std::string l_checkFileName; std::vector l_vector; @@ -683,7 +726,7 @@ void CLoggerCfg::AddLoggingParamCB(CbFuncPtr f_fp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); } -void CLoggerCfg::UpdateLoggingStatus(void) noexcept { +void CLoggerCfg::UpdateLoggingStatus(void) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); std::vector::iterator l_iter; for (l_iter = m_LoggingCallBack.begin(); l_iter != m_LoggingCallBack.end(); l_iter++) { // LCOV_EXCL_BR_LINE 11:Unexpected branch // NOLINT[whitespace/line_length] @@ -705,3 +748,7 @@ BOOL CLoggerCfg::IsLoggingEnabled(void) { return (this->m_eLoggerStatus == eActivate) ? TRUE : FALSE; FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); } + +ExternalLogList CLoggerCfg::GetExternalLogList(void) { + return (m_ExternalLogList); +} // LCOV_EXCL_BR_LINE 10:the last line diff --git a/logger_service/server/src/ss_logger_device_detection.cpp b/logger_service/server/src/ss_logger_device_detection.cpp index 8fbc5547..04bc4b5c 100644 --- a/logger_service/server/src/ss_logger_device_detection.cpp +++ b/logger_service/server/src/ss_logger_device_detection.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_error_event.cpp b/logger_service/server/src/ss_logger_error_event.cpp index 935e284a..6e82da7f 100644 --- a/logger_service/server/src/ss_logger_error_event.cpp +++ b/logger_service/server/src/ss_logger_error_event.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,9 +33,9 @@ #include #include #include -//#include +#include #include -//#include +#include #include #include "loggerservicedebug_loggerservicelog.h" #include "loggerservicedebug_thread_if.h" @@ -134,7 +134,7 @@ EFrameworkunifiedStatus CErrorEvent::Initialize(HANDLE f_hApp, CLoggerCfg *f_pLo ZONE_ERR, __FUNCTION__, " Error. Argument f_hApp passed NULL pointer. Initialization failed."); // LCOV_EXCL_STOP - } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_errorEventCfg.Initialize())) { // LCOV_EXCL_BR_LINE 200:To ensure success + } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_errorEventCfg.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // LCOV_EXCL_START 200:To ensure success AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, @@ -326,7 +326,7 @@ EFrameworkunifiedStatus CErrorEvent::OnStartLogging(HANDLE f_hApp) { } uint8_t status; -// Clock_getSystemTimeY2K38(&m_time, &status); + Clock_getSystemTimeY2K38(&m_time, &status); m_currentEventTriggerNumber = m_pLoggerCfg->GetUserInvokedCounter(); l_eStatus = m_loggerUtil.checkDestinationAvailable(l_eventData); if (eFrameworkunifiedStatusOK == l_eStatus) { @@ -517,7 +517,7 @@ EFrameworkunifiedStatus CErrorEvent::RequestNextArtifact(HANDLE f_hApp) { return (l_eStatus); } uint8_t status; -// Clock_getSystemTimeY2K38(&m_time, &status); + Clock_getSystemTimeY2K38(&m_time, &status); FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. All logging error event artifacts have been collected."); l_eStatus = m_loggerUtil.checkDestinationAvailable(m_errorEventNtfData); @@ -958,7 +958,7 @@ EFrameworkunifiedStatus CErrorEvent::SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errT uint32_t l_time; uint8_t status; -// Clock_getSystemTimeY2K38(&l_time, &status); + Clock_getSystemTimeY2K38(&l_time, &status); l_eStatus = m_loggerUtil.getEmmcNaviLogParams(l_time, errType, l_Filename, l_logMaxNum); @@ -975,28 +975,28 @@ EFrameworkunifiedStatus CErrorEvent::SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errT } else { FILE *fp; void *p; -// p = EL_mem_exram_mmap_simple(EL_MEM_ID_NAVI_LOG, PROT_READ | PROT_WRITE, -// MAP_SHARED, -// EL_MEM_CACHE_INVALID); -// if (p == MAP_FAILED) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, -// "Error : EL_mem_exram_mmap_simple MAP_FAILD"); -// l_eStatus = eFrameworkunifiedStatusFail; -// } else { -// fp = fopen(l_Filename.c_str(), "wb"); -// if (fp == NULL) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open file %s", -// l_Filename.c_str()); -// l_eStatus = eFrameworkunifiedStatusAccessError; -// } else { -// fwrite(p, sizeof(unsigned char), EL_mem_getLength(EL_MEM_ID_NAVI_LOG), -// fp); -// fclose(fp); -// } -// if (0 != EL_mem_exram_munmap(p, EL_mem_getLength(EL_MEM_ID_NAVI_LOG))) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : EL_mem_exram_munmap"); -// } -// } + p = EL_mem_exram_mmap_simple(EL_MEM_ID_NAVI_LOG, PROT_READ | PROT_WRITE, + MAP_SHARED, + EL_MEM_CACHE_INVALID); + if (p == MAP_FAILED) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error : EL_mem_exram_mmap_simple MAP_FAILD"); + l_eStatus = eFrameworkunifiedStatusFail; + } else { + fp = fopen(l_Filename.c_str(), "wb"); + if (fp == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open file %s", + l_Filename.c_str()); + l_eStatus = eFrameworkunifiedStatusAccessError; + } else { + fwrite(p, sizeof(unsigned char), EL_mem_getLength(EL_MEM_ID_NAVI_LOG), + fp); + fclose(fp); + } + if (0 != EL_mem_exram_munmap(p, EL_mem_getLength(EL_MEM_ID_NAVI_LOG))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : EL_mem_exram_munmap"); + } + } } } diff --git a/logger_service/server/src/ss_logger_error_event_archive.cpp b/logger_service/server/src/ss_logger_error_event_archive.cpp index 3672d002..b7187054 100644 --- a/logger_service/server/src/ss_logger_error_event_archive.cpp +++ b/logger_service/server/src/ss_logger_error_event_archive.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp b/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp index f8c70ffc..f400e835 100644 --- a/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp +++ b/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ /////////////////////////////////////////////////////////////////////////////// #include #include -//#include +#include #include "ss_logger_error_event_can_evt_reply.h" CLoggerErrorEventCANEvtReply::CLoggerErrorEventCANEvtReply() { } @@ -68,31 +68,31 @@ EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishEndEvent( if (TRUE == IsEventNeeded(f_event)) { STEventCANLoggerEventInfo l_info; struct tm l_tm; -// CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm); -// if (CLOCK_OK == clock_ret) { -// l_info.valid = TRUE; -// l_info.success = TRUE; -// l_info.triggerNumber = f_triggerNumber; -// l_info.dateAndTime.DateTime_Stat = 0; -// l_info.dateAndTime.DateTimeDay = static_cast(l_tm.tm_mday); -// l_info.dateAndTime.DateTimeHour = static_cast(l_tm.tm_hour); -// l_info.dateAndTime.DateTimeMinute = static_cast(l_tm.tm_min); -// l_info.dateAndTime.DateTimeMonth = static_cast(l_tm.tm_mon + 1); -// l_info.dateAndTime.DateTimeSecond = static_cast(l_tm.tm_sec); -// l_info.dateAndTime.DateTimeYear = static_cast(l_tm.tm_year % 100); -// l_info.dateAndTime.TimeFormat = 0; -// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, -// " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d", -// l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth, -// l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour, -// l_info.dateAndTime.DateTimeMinute, -// l_info.dateAndTime.DateTimeSecond); -// -// } else { -// l_info.success = TRUE; -// l_info.valid = FALSE; -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid."); -// } + CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm); + if (CLOCK_OK == clock_ret) { + l_info.valid = TRUE; + l_info.success = TRUE; + l_info.triggerNumber = f_triggerNumber; + l_info.dateAndTime.DateTime_Stat = 0; + l_info.dateAndTime.DateTimeDay = static_cast(l_tm.tm_mday); + l_info.dateAndTime.DateTimeHour = static_cast(l_tm.tm_hour); + l_info.dateAndTime.DateTimeMinute = static_cast(l_tm.tm_min); + l_info.dateAndTime.DateTimeMonth = static_cast(l_tm.tm_mon + 1); + l_info.dateAndTime.DateTimeSecond = static_cast(l_tm.tm_sec); + l_info.dateAndTime.DateTimeYear = static_cast(l_tm.tm_year % 100); + l_info.dateAndTime.TimeFormat = 0; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d", + l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth, + l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour, + l_info.dateAndTime.DateTimeMinute, + l_info.dateAndTime.DateTimeSecond); + + } else { + l_info.success = TRUE; + l_info.valid = FALSE; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid."); + } l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventFinished, &l_info, sizeof(l_info)); @@ -112,30 +112,30 @@ EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishErrorEvent( if (TRUE == IsEventNeeded(f_event)) { STEventCANLoggerEventInfo l_info; struct tm l_tm; -// CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm); + CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm); l_info.valid = f_isValid; l_info.success = FALSE; -// if (CLOCK_OK == clock_ret) { -// l_info.triggerNumber = f_triggerNumber; -// l_info.dateAndTime.DateTime_Stat = 0; -// l_info.dateAndTime.DateTimeDay = static_cast(l_tm.tm_mday); -// l_info.dateAndTime.DateTimeHour = static_cast(l_tm.tm_hour); -// l_info.dateAndTime.DateTimeMinute = static_cast(l_tm.tm_min); -// l_info.dateAndTime.DateTimeMonth = static_cast(l_tm.tm_mon + 1); -// l_info.dateAndTime.DateTimeSecond = static_cast(l_tm.tm_sec); -// l_info.dateAndTime.DateTimeYear = static_cast(l_tm.tm_year % 100); -// l_info.dateAndTime.TimeFormat = 0; -// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, -// " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d", -// l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth, -// l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour, -// l_info.dateAndTime.DateTimeMinute, -// l_info.dateAndTime.DateTimeSecond); -// -// } else { -// l_info.valid = FALSE; -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid."); -// } + if (CLOCK_OK == clock_ret) { + l_info.triggerNumber = f_triggerNumber; + l_info.dateAndTime.DateTime_Stat = 0; + l_info.dateAndTime.DateTimeDay = static_cast(l_tm.tm_mday); + l_info.dateAndTime.DateTimeHour = static_cast(l_tm.tm_hour); + l_info.dateAndTime.DateTimeMinute = static_cast(l_tm.tm_min); + l_info.dateAndTime.DateTimeMonth = static_cast(l_tm.tm_mon + 1); + l_info.dateAndTime.DateTimeSecond = static_cast(l_tm.tm_sec); + l_info.dateAndTime.DateTimeYear = static_cast(l_tm.tm_year % 100); + l_info.dateAndTime.TimeFormat = 0; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d", + l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth, + l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour, + l_info.dateAndTime.DateTimeMinute, + l_info.dateAndTime.DateTimeSecond); + + } else { + l_info.valid = FALSE; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid."); + } l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventFinished, &l_info, sizeof(l_info)); LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: macro diff --git a/logger_service/server/src/ss_logger_error_event_cfg.cpp b/logger_service/server/src/ss_logger_error_event_cfg.cpp index ccc6082d..fcd733ef 100644 --- a/logger_service/server/src/ss_logger_error_event_cfg.cpp +++ b/logger_service/server/src/ss_logger_error_event_cfg.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,43 +54,27 @@ enum ARTIFACT_BIT { ARTIFACT_BIT_DEBUG_FOLDER2_CONTENT = 1 << (UI_32) eArtifactIdDebugFolder2Content, ARTIFACT_BIT_COM_LOG = 1 << (UI_32) eArtifactIdComDebugLog, - ARTIFACT_BIT_RADIO_LOG = 1 << (UI_32) eArtifactIdRadioDebugLog, - ARTIFACT_BIT_CONNECTIVITY_LOG = 1 << (UI_32) eArtifactIdConnectivityDebugLog, - ARTIFACT_BIT_GRAPHICS_LOG = 1 << (UI_32) eArtifactIdGraphicsDebugLog, - ARTIFACT_BIT_SYS_LOG = 1 << (UI_32) eArtifactIdSysLog, - ARTIFACT_BIT_PSTORE_LOG = 1 << (UI_32) eArtifactIdPstoreLog, - ARTIFACT_BIT_WINSYS_LOG = 1 << (UI_32) eArtifactIdWinSysLog, - ARTIFACT_BIT_APPFW_LOG = 1 << (UI_32) eArtifactIdAppFwLog, - ARTIFACT_BIT_TOMOYO_LOG = 1 << (UI_32) eArtifactIdTomoyoLog + ARTIFACT_BIT_PSTORE_LOG = 1 << (UI_32) eArtifactIdPstoreLog }; ////////////////////////////////////////////////////////////////////////////////////////// ///// Definition for Logging Artifact Filepaths ////////////////////////////////////////////////////////////////////////////////////////// -const char LAF_DEBUG_FOLDER[] = "/nv/log"; -const char LAF_DEBUG_FOLDER2[] = "/nv/log2"; +const char LAF_DEBUG_FOLDER[] = "/nv/BS/ss/logger_service/rwdata"; +const char LAF_DEBUG_FOLDER2[] = "/nv/BS/ss/logger_service/rwdata/log2"; const char LAF_MONTECARLO_FN[] = "/tmp/MonteCarlo"; const char LAF_METACORE_FN[] = "/tmp/MetaCore"; const char LAF_CMS_FN[] = "/tmp/cms"; const char LAF_INT_DTC_FN[] = "/tmp/dtc_error.log"; -const char LAF_LOGGERSERVICELOG_COM[] = "/ramd/log/frameworkunifiedlog/communication"; -const char LAF_LOGGERSERVICELOG_RDO[] = "/ramd/log/frameworkunifiedlog/radio"; -const char LAF_LOGGERSERVICELOG_CONNECTIVITY[] = "/ramd/log/frameworkunifiedlog/connectivity"; -const char LAF_GRAPHICS_FN[] = "/ramd/log/frameworkunifiedlog/graphics.log"; -const char LAF_KERNEL_BOOT_FN[] = "/ramd/log/frameworkunifiedlog/kernelboot.log"; -const char LAF_SYSLOG[] = "/ramd/log/frameworkunifiedlog/syslog"; +const char LAF_LOGGERSERVICELOG_COM[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/communication"; +const char LAF_KERNEL_BOOT_FN[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/kernelboot.log"; const char LAF_PSTORELOG[] = "/dev/pstore"; -const char LAF_WINSYS_FN[] = "/ramd/log/frameworkunifiedlog/winsys.log"; -const char LAF_APPFW[] = "/ramd/log/frameworkunifiedlog/appfw"; -const char LAF_TOMOYO[] = "/nv/ptdata/sec/tomoyo"; #define ARTIFACT_BIT_ALL_OUTPUT_LOG (ARTIFACT_BIT_LOGGERSERVICE_DEBUG_LOG | \ ARTIFACT_BIT_DEBUG_DUMP_LOG | \ ARTIFACT_BIT_SYSTEM_DATA_LOG | \ ARTIFACT_BIT_SHOW_MEM_TXT | \ ARTIFACT_BIT_COM_LOG | \ - ARTIFACT_BIT_RADIO_LOG | \ - ARTIFACT_BIT_CONNECTIVITY_LOG | \ ARTIFACT_BIT_KERNEL_LOG | \ ARTIFACT_BIT_KERNEL_BOOT_LOG | \ ARTIFACT_BIT_SCREEN_SHOT | \ @@ -100,13 +84,8 @@ const char LAF_TOMOYO[] = "/nv/ptdata/sec/tomoyo"; ARTIFACT_BIT_DRLOCATION_LOG | \ ARTIFACT_BIT_CHLM_MC_LOGS | \ ARTIFACT_BIT_INTERNAL_DTC_LOG | \ - ARTIFACT_BIT_GRAPHICS_LOG | \ - ARTIFACT_BIT_SYS_LOG | \ ARTIFACT_BIT_METACORE_LOGS | \ - ARTIFACT_BIT_PSTORE_LOG | \ - ARTIFACT_BIT_WINSYS_LOG | \ - ARTIFACT_BIT_APPFW_LOG | \ - ARTIFACT_BIT_TOMOYO_LOG) + ARTIFACT_BIT_PSTORE_LOG) TLoggingArtifactCfg CErrorEventCfg::m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue] = { { eErrorEventTypeProcessCrash, { (ARTIFACT_BIT_ALL_OUTPUT_LOG @@ -191,56 +170,30 @@ TLoggingArtifactCfg CErrorEventCfg::m_loggerErrorEventCfgTbl[eErrorEventTypeMaxV TLoggingArtifact CErrorEventCfg::m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue] = { // LCOV_EXCL_BR_LINE 11:Unexpected branch /*Artifact ID Owner Timeout Callback Type Path CallBack Function Delete tmp artifact*/ - { eArtifactIdInterfaceunifiedDebugLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", - SSLogger_SendtoSelf }, TRUE } }, { eArtifactIdTransmitLog, - { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, - TRUE } }, { eArtifactIdPerformanceLog, { SERVICE_LOGGER, 5, { - eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } }, { - eArtifactIdBootMicroLog, { SERVICE_SYSMANAGER, 1000, { eCbTypeFunction, - "", SSLogger_SendtoSM }, TRUE } }, { eArtifactIdSystemDataCsv, { - SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, - TRUE } }, { eArtifactIdShowMemTxt, { SERVICE_SYSMANAGER, 8000, { - eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } }, { - eArtifactIdProcessCore, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, - "", SSLogger_SendtoSM }, TRUE } }, { eArtifactIdDebugDumpLog, { - SERVICE_SYSMANAGER, 4000, { eCbTypeFunction, "", SSLogger_SendtoSM }, - TRUE } }, { eArtifactIdScreenShot, { SERVICE_LOGGER, 1100, { - eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, { - eArtifactIdDebugFolderContent, { SERVICE_LOGGER, 50000, { eCbTypePath, - LAF_DEBUG_FOLDER, NULL }, FALSE } }, { - eArtifactIdDebugFolder2Content, { SERVICE_LOGGER, 50000, { eCbTypePath, - LAF_DEBUG_FOLDER2, NULL }, FALSE } }, { eArtifactIdKernelLog, - { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, - TRUE } }, { eArtifactIdKernelBootLog, { SERVICE_LOGGER, 5000, { - eCbTypePath, LAF_KERNEL_BOOT_FN, NULL }, FALSE } }, { - eArtifactIdDRInitialLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", - SSLogger_SendtoSelf }, TRUE } }, { eArtifactIdDRLocationLog, - { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, - TRUE } }, { eArtifactIdCpuHighLoadMonteCarloLogs, { SERVICE_LOGGER, - 50, { eCbTypePath, LAF_MONTECARLO_FN, NULL }, TRUE } }, { - eArtifactIdMetaCoreLogs, { SERVICE_LOGGER, 50, { eCbTypePath, - LAF_METACORE_FN, NULL }, TRUE } }, { eArtifactIdCmsLogs, { - SERVICE_LOGGER, 500, { eCbTypePath, LAF_CMS_FN, NULL }, TRUE } }, { - eArtifactIDInternalDTC, { SERVICE_LOGGER, 500, { eCbTypePath, - LAF_INT_DTC_FN, NULL }, TRUE } }, { eArtifactIdComDebugLog, { - SERVICE_LOGGER, 500, { eCbTypePath, LAF_LOGGERSERVICELOG_COM, NULL }, FALSE } }, { - eArtifactIdRadioDebugLog, { SERVICE_LOGGER, 500, { eCbTypePath, - LAF_LOGGERSERVICELOG_RDO, NULL }, FALSE } }, { - eArtifactIdConnectivityDebugLog, { SERVICE_LOGGER, 500, { eCbTypePath, - LAF_LOGGERSERVICELOG_CONNECTIVITY, NULL }, FALSE } }, { - eArtifactIdGraphicsDebugLog, { SERVICE_LOGGER, 50, { eCbTypePath, - LAF_GRAPHICS_FN, NULL }, FALSE } }, { eArtifactIdSysLog, { - SERVICE_LOGGER, 50, { eCbTypePath, LAF_SYSLOG, NULL }, FALSE } }, { - eArtifactIdPstoreLog, { SERVICE_LOGGER, 50, { eCbTypePath, - LAF_PSTORELOG, NULL }, FALSE } }, { eArtifactIdClearAllLog, - { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, - FALSE } }, { eArtifactIdNaviLog, { SERVICE_LOGGER, 5000, { - eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } }, { - eArtifactIdWinSysLog, { SERVICE_LOGGER, 50, { eCbTypePath, - LAF_WINSYS_FN, NULL }, FALSE } }, { eArtifactIdAppFwLog, { - SERVICE_LOGGER, 500, { eCbTypePath, LAF_APPFW, NULL }, FALSE } }, { - eArtifactIdTomoyoLog, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_TOMOYO, - NULL }, TRUE } } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch + { eArtifactIdInterfaceunifiedDebugLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, + { eArtifactIdTransmitLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, + { eArtifactIdPerformanceLog, { SERVICE_LOGGER, 5, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } }, + { eArtifactIdBootMicroLog, { SERVICE_SYSMANAGER, 1000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } }, + { eArtifactIdSystemDataCsv, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } }, + { eArtifactIdShowMemTxt, { SERVICE_SYSMANAGER, 8000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } }, + { eArtifactIdProcessCore, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } }, + { eArtifactIdDebugDumpLog, { SERVICE_SYSMANAGER, 4000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } }, + { eArtifactIdScreenShot, { SERVICE_LOGGER, 1100, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, + { eArtifactIdDebugFolderContent, { SERVICE_LOGGER, 50000, { eCbTypePath, LAF_DEBUG_FOLDER, NULL }, FALSE } }, + { eArtifactIdDebugFolder2Content, { SERVICE_LOGGER, 50000, { eCbTypePath, LAF_DEBUG_FOLDER2, NULL }, FALSE } }, + { eArtifactIdKernelLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, + { eArtifactIdKernelBootLog, { SERVICE_LOGGER, 5000, { eCbTypePath, LAF_KERNEL_BOOT_FN, NULL }, FALSE } }, + { eArtifactIdDRInitialLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, + { eArtifactIdDRLocationLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } }, + { eArtifactIdCpuHighLoadMonteCarloLogs, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_MONTECARLO_FN, NULL }, TRUE } }, + { eArtifactIdMetaCoreLogs, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_METACORE_FN, NULL }, TRUE } }, + { eArtifactIdCmsLogs, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_CMS_FN, NULL }, TRUE } }, + { eArtifactIDInternalDTC, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_INT_DTC_FN, NULL }, TRUE } }, + { eArtifactIdComDebugLog, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_LOGGERSERVICELOG_COM, NULL }, FALSE } }, + { eArtifactIdPstoreLog, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_PSTORELOG, NULL }, FALSE } }, + { eArtifactIdClearAllLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } }, + { eArtifactIdNaviLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } }, +}; // LCOV_EXCL_BR_LINE 11:Unexpected branch CErrorEventCfg::CErrorEventCfg() { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); @@ -254,11 +207,14 @@ CErrorEventCfg::~CErrorEventCfg() { // LCOV_EXCL_START 14:globle instance } // LCOV_EXCL_STOP -EFrameworkunifiedStatus CErrorEventCfg::Initialize(void) { +EFrameworkunifiedStatus CErrorEventCfg::Initialize(CLoggerCfg* p_logger_cfg) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; UI_32 l_cnt; + m_ext_log_num = 0; + ExternalLogList ext_log = p_logger_cfg->GetExternalLogList(); + for (l_cnt = 0; l_cnt < eArtifactIdMaxValue; l_cnt++) { EArtifactId l_artifactId = m_loggerErrorArtifactCfgTbl[l_cnt].ArtifactId; TLoggingArtifactInformation l_artifactInformation = @@ -272,6 +228,27 @@ EFrameworkunifiedStatus CErrorEventCfg::Initialize(void) { m_errorEventTypeToArtifactBitMaskMap[l_eventType] = l_errorEvtInformation; } + // Set external log info + if (ext_log.num > 0) { + if (ext_log.num <= ext_log.max) { + m_ext_log_num = ext_log.num; + } else { + m_ext_log_num = ext_log.max; + } + + for (UI_32 i = 0; i < m_ext_log_num; i++) { + EArtifactId l_artifactId = (EArtifactId) (eArtifactIdMaxValue + i); + TLoggingArtifactInformation artifact_info; + artifact_info.Cb.Function = NULL; + artifact_info.Cb.Path = ext_log.p_info[i].path; + artifact_info.Cb.Type = eCbTypePath; + artifact_info.OwnerServiceName = SERVICE_LOGGER; + artifact_info.Remove = ext_log.p_info[i].remove; + artifact_info.RequestTimeoutMs = 5000; + m_errorArtifactMap[l_artifactId] = artifact_info; + } + } + l_eStatus = (EFrameworkunifiedStatus) ValidateConfiguration(); LOG_STATUS_IF_ERRORED(l_eStatus, "ValidateConfiguration()"); // LCOV_EXCL_BR_LINE 5:macro @@ -283,12 +260,13 @@ UI_32 CErrorEventCfg::ValidateConfiguration(void) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); UI_32 l_return = 0; - if (eArtifactIdMaxValue != m_errorArtifactMap.size()) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eArtifactIdMaxValue + + if ((eArtifactIdMaxValue + m_ext_log_num) != m_errorArtifactMap.size()) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eArtifactIdMaxValue // LCOV_EXCL_START 6:Be sure not to exceed the eArtifactIdMaxValue AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Artifact map size mismatch: Expected: %d, Found: %d", - eArtifactIdMaxValue, m_errorArtifactMap.size()); + (eArtifactIdMaxValue + m_ext_log_num), m_errorArtifactMap.size()); l_return |= 1; // LCOV_EXCL_STOP } @@ -331,6 +309,15 @@ void CErrorEventCfg::GetArtifactRequestVec( f_refArtifactRequestVec.push_back(l_artifact); } } + + // Set external log info + if (m_ext_log_num > 0) { + for (l_artifactId = 0; l_artifactId < m_ext_log_num; l_artifactId++) { + l_artifact.ArtifactId = (EArtifactId) (eArtifactIdMaxValue + l_artifactId); + l_artifact.Information = m_errorArtifactMap[l_artifact.ArtifactId]; + f_refArtifactRequestVec.push_back(l_artifact); + } + } } FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); diff --git a/logger_service/server/src/ss_logger_error_event_responses.cpp b/logger_service/server/src/ss_logger_error_event_responses.cpp index ec8bbd48..dc23d8ba 100644 --- a/logger_service/server/src/ss_logger_error_event_responses.cpp +++ b/logger_service/server/src/ss_logger_error_event_responses.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -260,67 +260,6 @@ EFrameworkunifiedStatus CErrorEvent::OnObtainPerformanceLogRequest(HANDLE f_hApp return (l_eStatus); } -#define SCREEN_SHOT_INTVAL 500000 // 500msec -#define SCRREN_SHOT_CAPTURE_RETRY_CNT 2 - -static EFrameworkunifiedStatus SaveScreenShot(char *chldexe, char **argv, int m_sfd, - CL_ProcessAttr_t *attr) { - int selection = -1; - fd_set fds; - struct timeval tv; - pid_t childpid; - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; - int retry = 0; - - while (1) { - childpid = CL_ProcessCreate(chldexe, argv, NULL, attr); - if (childpid == -1) { // LCOV_EXCL_BR_LINE 5: c code case - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "create process failed returned: %d", - errno); - } else { - do { - tv.tv_sec = 5; - tv.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(m_sfd, &fds); - selection = select(m_sfd + 1, &fds, NULL, NULL, &tv); - } while ((selection < 0) && (errno == EINTR)); // LCOV_EXCL_BR_LINE 5: c code case - if (selection < 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "select failed %d", errno); - } else { - if (FD_ISSET(m_sfd, &fds)) { // LCOV_EXCL_BR_LINE 5: FD_ISSET's error case - CL_ProcessCleanupInfo_t cinfo; - int ret; - - ret = CL_ProcessCleanup(m_sfd, &cinfo); - if ((ret != -1) && (cinfo.code == CLD_EXITED)) { - if (cinfo.status != 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Save Error! cinfo.status:%d", - cinfo.status); - } else { - l_eStatus = eFrameworkunifiedStatusOK; - } - } - } else { - // LCOV_EXCL_START 5: FD_ISSET's error case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - // (FD_ISSET() failed Error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fd Not Exist fd Error\n"); - // LCOV_EXCL_STOP - } - } - } - if ((l_eStatus == eFrameworkunifiedStatusOK) - || (retry >= (SCRREN_SHOT_CAPTURE_RETRY_CNT - 1))) { - break; - } - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "retry!"); - usleep(SCREEN_SHOT_INTVAL); // interval - retry++; - } - return l_eStatus; -} - /////////////////////////////////////////////////////////////////////////// // Function : OnObtainScreenShotRequest // brief : Collect screen shot artifact from PLM and return a response @@ -329,87 +268,14 @@ static EFrameworkunifiedStatus SaveScreenShot(char *chldexe, char **argv, int m_ EFrameworkunifiedStatus CErrorEvent::OnObtainScreenShotRequest(HANDLE f_hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - std::string dir_path = SCREEN_SHOT_PATH; EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; - EFrameworkunifiedStatus l_eStatusCh0 = eFrameworkunifiedStatusFail; - EFrameworkunifiedStatus l_eStatusCh1 = eFrameworkunifiedStatusFail; - - char *c_argv0[4] = { NULL, const_cast(JPEG_PATH_CH0), const_cast("0"), NULL }; - char *c_argv1[4] = { NULL, const_cast(JPEG_PATH_CH1), const_cast("1"), NULL }; - char *chldexe; - - /*check m_sfd vlue*/ - if (m_sfd == -1) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_Logger_SaveScreenShot m_sfd error -1"); - return l_eStatus; - } - /*check chldexe value*/ - chldexe = realpath(SCRSHOT_EXE_PATH, NULL); - if (chldexe == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "SS_Logger_SaveScreenShot realpath failed %d", errno); - return l_eStatus; - } - - c_argv0[0] = chldexe; - c_argv1[0] = chldexe; - l_eStatus = CFSDirectory::CreateDirectory(dir_path); - if (l_eStatus != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "SS_Logger_SaveScreenShot tmp directory failed"); - free(chldexe); - return l_eStatus; - } else { - CL_ProcessAttr_t attr; - CL_ProcessCreateAttrInit(&attr); - - /* Save Picture Ch0(E2) */ - l_eStatusCh0 = SaveScreenShot(chldexe, c_argv0, m_sfd, &attr); - if (l_eStatusCh0 == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 200:As there are no ScreenShot processes - // LCOV_EXCL_START 200:As there are no ScreenShot processes - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Start Save Picture Ch1(M2) */ - l_eStatusCh1 = SaveScreenShot(chldexe, c_argv1, m_sfd, &attr); - if (l_eStatusCh1 != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "SS_Logger_SaveScreenShot Ch1(M2) failed"); - } - // LCOV_EXCL_STOP - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_Logger_SaveScreenShot Ch0(E2) failed"); - } - } - - // Send Artifact Responce. - if ((l_eStatusCh0 == eFrameworkunifiedStatusOK) || (l_eStatusCh1 == eFrameworkunifiedStatusOK)) { // LCOV_EXCL_BR_LINE 200:As there are no ScreenShot processes - // LCOV_EXCL_START 200:As there are no ScreenShot processes - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - // Set "SCREEN_SHOT_PATH" to save two pictures(ch0(E2) and ch1(M2)) - l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdScreenShot, - SCREEN_SHOT_PATH); - LOG_STATUS_IF_ERRORED( - l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdScreenShot)"); - // LCOV_EXCL_STOP - } else { - // If both Ch0 and Ch1 is failed, - // update l_eStatus to eFrameworkunifiedStatusFail and delete directory. - l_eStatus = eFrameworkunifiedStatusFail; - if (CFSDirectory::DoesDirectoryExist(dir_path)) { - if (CFSDirectory::RemoveDirectory(dir_path)) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - "SS_Logger_SaveScreenShot directory delete successful."); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "SS_Logger_SaveScreenShot directory delete unsuccessful"); - } - } - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "SS_Logger_SaveScreenShot Save Failed returned:%d", l_eStatus); - } - free(chldexe); + l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdScreenShot, + SCREEN_SHOT_PATH); + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdScreenShot)"); FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return (l_eStatus); + return l_eStatus; } /////////////////////////////////////////////////////////////////////////// @@ -563,8 +429,7 @@ EFrameworkunifiedStatus CErrorEvent::OnClearAllLogRequest(HANDLE f_hApp) { clear_file_path.c_str()); } - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - clear_file_path = "/nv/log2/awlog/"; + clear_file_path = "/nv/BS/ss/logger_service/rwdata/log2/awlog/"; if (CFSDirectory::RemoveSubDirectory(clear_file_path)) { FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_Logger Clear %s directory delete successful.", @@ -575,7 +440,7 @@ EFrameworkunifiedStatus CErrorEvent::OnClearAllLogRequest(HANDLE f_hApp) { clear_file_path.c_str()); } - clear_file_path = "/nv/log2/core/"; + clear_file_path = "/nv/BS/ss/logger_service/rwdata/log2/core/"; if (CFSDirectory::RemoveSubDirectory(clear_file_path)) { FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_Logger Clear %s directory delete successful.", @@ -585,7 +450,6 @@ EFrameworkunifiedStatus CErrorEvent::OnClearAllLogRequest(HANDLE f_hApp) { "SS_Logger Clear %s directory delete failed.", clear_file_path.c_str()); } - // LCOV_EXCL_STOP l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdClearAllLog, clear_file_path.c_str()); @@ -604,8 +468,6 @@ EFrameworkunifiedStatus CErrorEvent::OnNaviLogRequest(HANDLE f_hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - // LCOV_EXCL_START 13: - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert EFrameworkunifiedStatus naviLog_status; switch (m_errorEventNtfData.EventType) { case eErrorEventTypeProcessCrash: @@ -625,7 +487,6 @@ EFrameworkunifiedStatus CErrorEvent::OnNaviLogRequest(HANDLE f_hApp) { } FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Fail to save Navi Log %d", naviLog_status); - // LCOV_EXCL_STOP l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdNaviLog, ""); LOG_STATUS_IF_ERRORED(l_eStatus, diff --git a/logger_service/server/src/ss_logger_error_event_storage.cpp b/logger_service/server/src/ss_logger_error_event_storage.cpp index 1bbec7cf..ffdebe73 100644 --- a/logger_service/server/src/ss_logger_error_event_storage.cpp +++ b/logger_service/server/src/ss_logger_error_event_storage.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,7 +198,7 @@ void CLoggerErrorEventStorage::ThreadFunction(void) { TArtifactResponseVec l_responseVec; uint32_t l_logTime; uint8_t status; -// Clock_getSystemTimeY2K38(&l_logTime, &status); + Clock_getSystemTimeY2K38(&l_logTime, &status); (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &l_oldState); if (EOK == pthread_mutex_lock(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_lock's error case. l_target = this->m_destination; @@ -420,7 +420,7 @@ EFrameworkunifiedStatus CLoggerErrorEventStorage::PackageAndPlaceArtifacts( AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert char buffer[20]; struct tm local_time; -// Clock_getLocalTimeY2K38(&f_logTime, &local_time); + Clock_getLocalTimeY2K38(&f_logTime, &local_time); if (0 != strftime(buffer, sizeof(buffer), "%Y%m%d%H%M%S.bmp", &local_time)) { diff --git a/logger_service/server/src/ss_logger_fs_directory.cpp b/logger_service/server/src/ss_logger_fs_directory.cpp index 6228f265..4cb3996d 100644 --- a/logger_service/server/src/ss_logger_fs_directory.cpp +++ b/logger_service/server/src/ss_logger_fs_directory.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_popups.cpp b/logger_service/server/src/ss_logger_popups.cpp index 54170dcd..92a57379 100644 --- a/logger_service/server/src/ss_logger_popups.cpp +++ b/logger_service/server/src/ss_logger_popups.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_reader_writer_control.cpp b/logger_service/server/src/ss_logger_reader_writer_control.cpp index b6b6b7e7..692cab8d 100644 --- a/logger_service/server/src/ss_logger_reader_writer_control.cpp +++ b/logger_service/server/src/ss_logger_reader_writer_control.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_server_callbacks.cpp b/logger_service/server/src/ss_logger_server_callbacks.cpp index 2cdf12cf..82a677be 100644 --- a/logger_service/server/src/ss_logger_server_callbacks.cpp +++ b/logger_service/server/src/ss_logger_server_callbacks.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/ss_logger_util.cpp b/logger_service/server/src/ss_logger_util.cpp index a0467b2d..6ac72251 100644 --- a/logger_service/server/src/ss_logger_util.cpp +++ b/logger_service/server/src/ss_logger_util.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ #include #include #include -//#include +#include #include #include #include @@ -835,7 +835,7 @@ std::string CLoggerUtil::GetTimeString(uint32_t f_time) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); std::string l_ret = "00000000_000000"; struct tm local_time; -// Clock_getLocalTimeY2K38(&f_time, &local_time); + Clock_getLocalTimeY2K38(&f_time, &local_time); char buffer[20]; if (0 != strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", // LCOV_EXCL_BR_LINE 5: c code @@ -1019,8 +1019,8 @@ EFrameworkunifiedStatus CLoggerUtil::CopyUntyped(std::string f_source, } else if (0 != S_ISDIR(l_stat.st_mode)) { l_eStatus = CopyDirectory(f_source, f_destination); } else if (0 != S_ISLNK(l_stat.st_mode)) { - // avoid duplicate copy for eErrorEventTypeInterfaceunifiedEmmcLogs: /nv/log/awlog -> /nv/log2/awlog - if (f_source.find("/nv/log/awlog") == std::string::npos) { + // avoid duplicate copy for eErrorEventTypeInterfaceunifiedEmmcLogs: /nv/log/awlog -> /nv/BS/ss/logger_service/rwdata/log2/awlog + if (f_source.find("/nv/BS/ss/logger_service/rwdata/awlog") == std::string::npos) { l_eStatus = CopyDirectory(f_source, f_destination); } } else if (0 != S_ISREG(l_stat.st_mode)) { diff --git a/logger_service/server/src/udp_file_writer.cpp b/logger_service/server/src/udp_file_writer.cpp index ce04ae00..c07db07a 100644 --- a/logger_service/server/src/udp_file_writer.cpp +++ b/logger_service/server/src/udp_file_writer.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/udp_writer.cpp b/logger_service/server/src/udp_writer.cpp index d4ef747a..8fc4d84c 100644 --- a/logger_service/server/src/udp_writer.cpp +++ b/logger_service/server/src/udp_writer.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/src/writer.cpp b/logger_service/server/src/writer.cpp index f6c6ab24..907b202d 100644 --- a/logger_service/server/src/writer.cpp +++ b/logger_service/server/src/writer.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logger_service/server/work/Makefile b/logger_service/server/work/Makefile index 2b60ed70..79cef35b 100644 --- a/logger_service/server/work/Makefile +++ b/logger_service/server/work/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -73,7 +73,6 @@ CPPFLAGS += -DRELEASE_BUILD CPPFLAGS += -DLINUX CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3 CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND -CXXFLAGS += -std=c++11 CPPFLAGS_mem_reader.o = -fno-exceptions CPPFLAGS_reader.o = -fno-exceptions @@ -105,7 +104,7 @@ CPPFLAGS_udp_writer.o = -fno-exceptions ######### linked library ############# LDFLAGS += -L../lib/ LDLIBS += -Wl,-Bstatic -lSS_LoggerStoreLogs -#LDLIBS += -Wl,-Bstatic -lPFDRECThread +LDLIBS += -Wl,-Bstatic -lPFDRECThread ######### linked library (dynamic) ############# LDLIBS += -Wl,-Bdynamic -lc #Substitute for libsocket @@ -116,12 +115,11 @@ LDLIBS += -Wl,-Bdynamic -ltar LDLIBS += -Wl,-Bdynamic -lz LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy -LDLIBS += -Wl,-Bdynamic -lvp LDLIBS += -Wl,-Bdynamic -lns_backup #for PFDRECTread LDLIBS += -Wl,-Bdynamic -lcommon LDLIBS += -Wl,-Bdynamic -lcrypto -#LDLIBS += -Wl,-Bdynamic -lextension -#LDLIBS += -Wl,-Bdynamic -lClock_API +LDLIBS += -Wl,-Bdynamic -lextension +LDLIBS += -Wl,-Bdynamic -lClock_API LINK_CXX=Y -- cgit 1.2.3-korg