summaryrefslogtreecommitdiffstats
path: root/external/meta-sdl/recipes-automotive/sdl-core/sdl-core/0005-add-env-for-log4cxx-properties-path.patch
blob: 75d439064ba079554ad9c4632534d4d4fac7a7b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 570405af8e5c874db1852bdfb333ec0c941093ac Mon Sep 17 00:00:00 2001
From: Phong Tran <tranmanphong@gmail.com>
Date: Sun, 12 Feb 2017 16:54:48 +0700
Subject: [PATCH 05/10] add env for log4cxx properties path

Add the env variable SDL_LOG4CXX_PROPERTIES_FILE
to indicate the path of log4cxx configure file.

%% original patch: 0005-add-env-for-log4cxx-properties-path.patch
---
 src/appMain/main.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index feb5b58..08e65f7 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -112,8 +112,13 @@ int32_t main(int32_t argc, char** argv) {
 
   // --------------------------------------------------------------------------
   // Logger initialization
-  INIT_LOGGER("log4cxx.properties", profile_instance.logs_enabled());
-
+  const char* log4cxx_path = getenv("SDL_LOG4CXX_PROPERTIES_FILE");
+  if (!log4cxx_path) {
+    INIT_LOGGER("log4cxx.properties", profile_instance.logs_enabled());
+  } else {
+    std::string log4cxx_properties = std::string(log4cxx_path);
+    INIT_LOGGER(log4cxx_properties, profile_instance.logs_enabled());
+  }
   threads::Thread::SetNameForId(threads::Thread::CurrentId(), "MainThread");
 
   if (!utils::appenders_loader.Loaded()) {
-- 
2.7.4