Add support for dlog 02/245302/3
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 7 Oct 2020 02:08:26 +0000 (11:08 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 7 Oct 2020 10:55:10 +0000 (19:55 +0900)
1. Add support for dlog
2. Add some log options to main.conf
3. Allow to simplify the amount of logs by option

Change-Id: I8c1202ae267aca9bb2c18d44c2ccd3e6d5a74a73
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
17 files changed:
Makefile.am
Makefile.plugins
configure.ac
connman.pc.in
gsupplicant/supplicant.c
packaging/connman.spec
plugins/wifi.c
src/config.c
src/connman.h
src/device.c
src/ipconfig.c
src/log.c
src/main.c
src/main.conf
src/network.c
src/service.c
src/timeserver.c

index b765875..d502be7 100644 (file)
@@ -159,7 +159,7 @@ src_connmand_SOURCES += src/mesh.c src/mesh-netlink.c
 endif
 
 src_connmand_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
-                       @GLIB_LIBS@ @DBUS_LIBS@ @GNUTLS_LIBS@ @LIBSYSTEMD_LIBS@ \
+                       @DLOG_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @GNUTLS_LIBS@ @LIBSYSTEMD_LIBS@ \
                        -lresolv -ldl -lrt
 
 if TIZEN_EXT_WIFI_MESH
@@ -172,7 +172,7 @@ src_connmand_LDFLAGS = -Wl,--export-dynamic -pie \
 src_connmand_wait_online_SOURCES = src/connmand-wait-online.c
 
 src_connmand_wait_online_LDADD = gdbus/libgdbus-internal.la \
-                       @GLIB_LIBS@ @DBUS_LIBS@
+                       @DLOG_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@
 
 if XTABLES
 src_connmand_SOURCES += src/iptables.c src/firewall-iptables.c
@@ -229,7 +229,7 @@ vpn_connman_vpnd_SOURCES += src/mesh.c src/mesh-netlink.c
 endif
 
 vpn_connman_vpnd_LDADD = gdbus/libgdbus-internal.la $(builtin_vpn_libadd) \
-                               @GLIB_LIBS@ @DBUS_LIBS@ @GNUTLS_LIBS@ \
+                               @DLOG_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @GNUTLS_LIBS@ \
                                @LIBSYSTEMD_LIBS@ @XTABLES_LIBS@ \
                                -lresolv -ldl
 
@@ -284,7 +284,7 @@ build_vpn_plugindir = $(vpn_plugindir)
 endif
 endif
 
-AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @LIBSYSTEMD_CFLAGS@\
+AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @LIBSYSTEMD_CFLAGS@ @DLOG_CFLAGS@ \
                                @GNUTLS_CFLAGS@ $(builtin_cflags) \
                                -DCONNMAN_PLUGIN_BUILTIN \
                                -DSTATEDIR=\""$(statedir)"\" \
@@ -302,7 +302,7 @@ else
 AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/gdbus
 endif
 
-src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
+src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @DLOG_CFLAGS@ \
                                @GNUTLS_CFLAGS@ $(builtin_cflags) \
                                -DCONNMAN_PLUGIN_BUILTIN \
                                -DSTATEDIR=\""$(statedir)"\" \
@@ -318,7 +318,7 @@ EXTRA_DIST = src/genbuiltin src/connman-dbus.conf src/connman-polkit.conf \
                                $(service_files_sources) scripts/connman.in
 
 if VPN
-vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
+vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ @DLOG_CFLAGS@ \
                                $(builtin_vpn_cflags) \
                                -DCONNMAN_PLUGIN_BUILTIN \
                                -DVPN_STATEDIR=\""$(vpn_statedir)"\" \
@@ -378,7 +378,7 @@ if TIZEN_EXT_INS
 client_connmanctl_SOURCES += client/ins.c client/ins.h
 endif
 
-client_connmanctl_LDADD = gdbus/libgdbus-internal.la @DBUS_LIBS@ @GLIB_LIBS@ \
+client_connmanctl_LDADD = gdbus/libgdbus-internal.la @DBUS_LIBS@ @GLIB_LIBS@ @DLOG_LIBS@ \
                                -lreadline -ldl -lncurses
 endif
 
@@ -387,7 +387,7 @@ noinst_PROGRAMS += unit/test-ippool
 unit_test_ippool_SOURCES = $(backtrace_sources) src/log.c src/dbus.c \
                                        src/error.c src/ippool.c unit/test-ippool.c
 unit_test_ippool_LDADD = gdbus/libgdbus-internal.la \
-                               @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+                               @GLIB_LIBS@ @DBUS_LIBS@ @DLOG_LIBS@ -ldl
 
 TESTS = unit/test-ippool
 
@@ -412,7 +412,7 @@ tools_supplicant_test_SOURCES = tools/supplicant-test.c \
                        tools/supplicant-dbus.h tools/supplicant-dbus.c \
                        tools/supplicant.h tools/supplicant.c
 tools_supplicant_test_LDADD = gdbus/libgdbus-internal.la \
-                               @GLIB_LIBS@ @DBUS_LIBS@
+                               @GLIB_LIBS@ @DBUS_LIBS@ @DLOG_LIBS@
 
 tools_web_test_SOURCES = $(gweb_sources) tools/web-test.c
 tools_web_test_LDADD = @GLIB_LIBS@ @GNUTLS_LIBS@ -lresolv
@@ -434,17 +434,17 @@ tools_dhcp_server_test_SOURCES =  $(backtrace_sources) src/log.c src/util.c \
 tools_dhcp_server_test_LDADD = @GLIB_LIBS@ -ldl
 
 tools_dbus_test_SOURCES = tools/dbus-test.c
-tools_dbus_test_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+tools_dbus_test_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@ @DLOG_LIBS@
 
-tools_polkit_test_LDADD = @DBUS_LIBS@
+tools_polkit_test_LDADD = @DBUS_LIBS@ @DLOG_LIBS@
 
-tools_private_network_test_LDADD = @GLIB_LIBS@ @DBUS_LIBS@
+tools_private_network_test_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @DLOG_LIBS@
 
 tools_session_test_SOURCES = $(backtrace_sources) src/log.c src/dbus.c src/error.c \
                tools/session-test.c tools/session-utils.c tools/manager-api.c \
                tools/session-api.c tools/session-test.h
 tools_session_test_LDADD = gdbus/libgdbus-internal.la \
-                               @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+                               @GLIB_LIBS@ @DBUS_LIBS@ @DLOG_LIBS@ -ldl
 
 if XTABLES
 noinst_PROGRAMS += tools/iptables-test tools/ip6tables-test tools/iptables-unit \
@@ -458,14 +458,14 @@ tools_ip6tables_test_SOURCES = $(backtrace_sources) src/log.c src/iptables.c \
                                tools/ip6tables-test.c
 tools_ip6tables_test_LDADD = @GLIB_LIBS@ @XTABLES_LIBS@ -ldl
 
-tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
+tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ @DLOG_CFLAGS@ \
                -DIPTABLES_SAVE=\""${IPTABLES_SAVE}"\" \
                -DIP6TABLES_SAVE=\""${IP6TABLES_SAVE}"\"
 tools_iptables_unit_SOURCES = $(backtrace_sources) src/log.c \
                src/iptables.c src/firewall-iptables.c src/nat.c \
                tools/iptables-unit.c
 tools_iptables_unit_LDADD = gdbus/libgdbus-internal.la \
-                               @GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ -ldl
+                               @GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ @DLOG_LIBS@ -ldl
 
 TESTS += unit/test-iptables
 
index 1eb0c3f..56fc4b3 100755 (executable)
@@ -1,6 +1,6 @@
 
 plugin_cflags = -fvisibility=hidden -I$(srcdir)/gdbus \
-                                       @DBUS_CFLAGS@ @GLIB_CFLAGS@
+                                       @DLOG_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@
 plugin_ldflags = -no-undefined -module -avoid-version
 
 if LOOPBACK
@@ -232,25 +232,25 @@ endif
 if OPENCONNECT
 script_PROGRAMS += scripts/openconnect-script
 
-scripts_openconnect_script_LDADD = @DBUS_LIBS@
+scripts_openconnect_script_LDADD = @DBUS_LIBS@ @DLOG_LIBS@
 else
 if VPNC
 script_PROGRAMS += scripts/openconnect-script
 
-scripts_openconnect_script_LDADD = @DBUS_LIBS@
+scripts_openconnect_script_LDADD = @DBUS_LIBS@ @DLOG_LIBS@
 endif
 endif
 
 if OPENVPN
 script_PROGRAMS += scripts/openvpn-script
 
-scripts_openvpn_script_LDADD = @DBUS_LIBS@
+scripts_openvpn_script_LDADD = @DBUS_LIBS@ @DLOG_LIBS@
 endif
 
 if IPSEC
 script_PROGRAMS += scripts/ipsec-script
 
-scripts_ipsec_script_LDADD = @DBUS_LIBS@
+scripts_ipsec_script_LDADD = @DBUS_LIBS@ @DLOG_LIBS@
 endif
 
 if NMCOMPAT
index bdece8d..62ab2a3 100644 (file)
@@ -308,6 +308,11 @@ PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
 
+PKG_CHECK_MODULES(DLOG, dlog, dummy=yes,
+                               AC_MSG_ERROR(dlog is required))
+AC_SUBST(DLOG_CFLAGS)
+AC_SUBST(DLOG_LIBS)
+
 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
        [path to D-Bus config directory]), [path_dbusconf=${withval}],
                [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
index 2af3c2b..0d38a26 100644 (file)
@@ -2,13 +2,13 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
+
 plugindir=${libdir}/connman/plugins
 scriptdir=${libdir}/connman/scripts
 
 Name: connman
 Description: Connection Manager
-Requires: glib-2.0 dbus-1
+Requires: dlog glib-2.0 dbus-1
 Version: @VERSION@
 Libs: -module -avoid-version -export-symbols-regex connman_plugin_desc
 Cflags: -I${includedir}
index c8d34e9..86100eb 100755 (executable)
 #include "dbus.h"
 #include "gsupplicant.h"
 
+#if defined TIZEN_EXT
+#include "setting.h"
+#endif
+
 #define IEEE80211_CAP_ESS      0x0001
 #define IEEE80211_CAP_IBSS     0x0002
 #define IEEE80211_CAP_PRIVACY  0x0010
@@ -456,6 +460,7 @@ struct assoc_count_data {
 };
 
 static unsigned int last_connected_bss_timeout = 0;
+static bool simplified_log = true;
 #endif
 
 static int network_remove(struct interface_data *data);
@@ -1133,7 +1138,9 @@ static void debug_strvalmap(const char *label, struct strvalmap *map,
                                                        unsigned int val)
 {
        int i;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        for (i = 0; map[i].str; i++) {
                if (val & map[i].val)
                        SUPPLICANT_DBG("%s: %s", label, map[i].str);
@@ -2927,7 +2934,9 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
                }
 
                if(ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0) {
-                       SUPPLICANT_DBG("IE: match vendor specific data");
+
+                       if (!simplified_log)
+                               SUPPLICANT_DBG("IE: match vendor specific data");
 
                        vsie_len = ie[1]+2;     // tag number size(1), tag length size(1)
                        vsie = (unsigned char *)g_try_malloc0(vsie_len);
@@ -3112,7 +3121,9 @@ static void bss_property(const char *key, DBusMessageIter *iter,
 
        if (!bss->interface)
                return;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("key %s", key);
 
        if (!key)
@@ -3219,7 +3230,9 @@ static struct g_supplicant_bss *interface_bss_added(DBusMessageIter *iter,
        GSupplicantNetwork *network;
        struct g_supplicant_bss *bss;
        const char *path = NULL;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        dbus_message_iter_get_basic(iter, &path);
@@ -3228,7 +3241,9 @@ static struct g_supplicant_bss *interface_bss_added(DBusMessageIter *iter,
 
        if (g_strcmp0(path, "/") == 0)
                return NULL;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("%s", path);
 
        network = g_hash_table_lookup(interface->bss_mapping, path);
@@ -3253,7 +3268,9 @@ static void interface_bss_added_with_keys(DBusMessageIter *iter,
                                                void *user_data)
 {
        struct g_supplicant_bss *bss;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        bss = interface_bss_added(iter, user_data);
@@ -3284,7 +3301,9 @@ static void interface_bss_added_without_keys(DBusMessageIter *iter,
                                                void *user_data)
 {
        struct g_supplicant_bss *bss;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        bss = interface_bss_added(iter, user_data);
@@ -3517,7 +3536,9 @@ static void wps_property(const char *key, DBusMessageIter *iter,
 
        if (!interface)
                return;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("key: %s", key);
 
        if (g_strcmp0(key, "ConfigMethods") == 0) {
@@ -3562,7 +3583,9 @@ static void interface_property(const char *key, DBusMessageIter *iter,
 
        if (!interface)
                return;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("%s", key);
 
        if (!key) {
@@ -3987,7 +4010,9 @@ static void signal_interface_removed(const char *path, DBusMessageIter *iter)
 static void signal_interface_changed(const char *path, DBusMessageIter *iter)
 {
        GSupplicantInterface *interface;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        interface = g_hash_table_lookup(interface_table, path);
@@ -4037,7 +4062,9 @@ static void signal_scan_done(const char *path, DBusMessageIter *iter)
 static void signal_bss_added(const char *path, DBusMessageIter *iter)
 {
        GSupplicantInterface *interface;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        interface = g_hash_table_lookup(interface_table, path);
@@ -4171,6 +4198,9 @@ static void signal_bss_changed(const char *path, DBusMessageIter *iter)
        unsigned int old_wps_capabilities;
        struct g_supplicant_bss *bss;
 
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        interface = g_hash_table_lookup(bss_mapping, path);
@@ -5707,6 +5737,9 @@ static void interface_get_result(const char *error,
        const char *path = NULL;
        int err;
 
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        if (error) {
@@ -5777,7 +5810,9 @@ done:
 static void interface_get_params(DBusMessageIter *iter, void *user_data)
 {
        struct interface_create_data *data = user_data;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        SUPPLICANT_DBG("");
 
        dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &data->ifname);
@@ -8478,7 +8513,9 @@ int g_supplicant_register(const GSupplicantCallbacks *callbacks)
                connection = NULL;
                return -EIO;
        }
-
+#if defined TIZEN_EXT
+       simplified_log = connman_setting_get_bool("SimplifiedLog");
+#endif
        callbacks_pointer = callbacks;
        eap_methods = 0;
 
index a8904e2..54bc17f 100644 (file)
@@ -12,6 +12,7 @@ Url:            http://connman.net
 Group:          Network & Connectivity/Connection Management
 Source0:        %{name}-%{version}.tar.gz
 BuildRequires:  systemd-devel
+BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gio-2.0)
index d532e93..6672f0d 100755 (executable)
@@ -3353,6 +3353,9 @@ static void system_killed(void)
 
 static int network_probe(struct connman_network *network)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p", network);
 
        return 0;
@@ -4819,7 +4822,9 @@ static void network_added(GSupplicantNetwork *supplicant_network)
 
        mode = g_supplicant_network_get_mode(supplicant_network);
        identifier = g_supplicant_network_get_identifier(supplicant_network);
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("%s", identifier);
 
        if (!g_strcmp0(mode, "adhoc"))
@@ -5072,7 +5077,8 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
        name = g_supplicant_network_get_name(network);
 
 #if defined TIZEN_EXT
-       DBG("name %s property %s", name, property);
+       if (!simplified_log)
+               DBG("name %s property %s", name, property);
 #else
        DBG("name %s", name);
 #endif
index 56ca2b8..d9907a1 100644 (file)
@@ -1591,7 +1591,9 @@ int __connman_config_provision_service(struct connman_service *service)
 
        /* For now only WiFi, Gadget and Ethernet services are supported */
        type = connman_service_get_type(service);
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p type %d", service, type);
 
        if (type != CONNMAN_SERVICE_TYPE_WIFI &&
index 9e28ffe..82e584e 100755 (executable)
@@ -1222,6 +1222,9 @@ int __connman_util_init(void);
 void __connman_util_cleanup(void);
 
 #ifdef TIZEN_EXT
+__attribute__ ((unused)) static bool dlog_logging = true;
+__attribute__ ((unused)) static bool file_logging = true;
+__attribute__ ((unused)) static bool simplified_log = true;
 __attribute__ ((unused)) static int __tizentvextension = -1;
 #define TIZEN_TV_EXT (__builtin_expect(__tizentvextension != -1, 1) ? \
        __tizentvextension : \
index 78b01f7..801400f 100755 (executable)
@@ -1124,6 +1124,9 @@ int connman_device_set_string(struct connman_device *device,
 const char *connman_device_get_string(struct connman_device *device,
                                                        const char *key)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("device %p key %s", device, key);
 
        if (g_str_equal(key, "Address"))
@@ -1151,7 +1154,9 @@ int connman_device_add_network(struct connman_device *device,
                                        struct connman_network *network)
 {
        const char *identifier = connman_network_get_identifier(network);
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("device %p network %p", device, network);
 
        if (!identifier)
@@ -1177,6 +1182,9 @@ int connman_device_add_network(struct connman_device *device,
 struct connman_network *connman_device_get_network(struct connman_device *device,
                                                        const char *identifier)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("device %p identifier %s", device, identifier);
 
        return g_hash_table_lookup(device->networks, identifier);
index fb39f64..6d8ba05 100755 (executable)
@@ -1203,7 +1203,9 @@ struct connman_ipconfig *__connman_ipconfig_create(int index,
        }
 
        ipconfig->system = connman_ipaddress_alloc(AF_INET);
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("ipconfig %p index %d", ipconfig, index);
 
        return ipconfig;
@@ -1239,7 +1241,9 @@ void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig,
 {
        if (!ipconfig)
                return;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount - 1,
                file, line, caller);
 
@@ -1653,7 +1657,9 @@ int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig)
 int __connman_ipconfig_disable(struct connman_ipconfig *ipconfig)
 {
        struct connman_ipdevice *ipdevice;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("ipconfig %p", ipconfig);
 
        if (!ipconfig || ipconfig->index < 0)
index 444e75f..8dbbb04 100755 (executable)
--- a/src/log.c
+++ b/src/log.c
@@ -40,6 +40,10 @@ static const char *program_path;
 #if defined TIZEN_EXT
 #include <sys/stat.h>
 #include <sys/time.h>
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "CONNMAN"
 
 #define LOG_FILE_PATH "/opt/usr/data/network/connman.log"
 #define MAX_LOG_SIZE   1 * 1024 * 1024
@@ -127,7 +131,7 @@ void __connman_log(const int log_priority, const char *format, va_list ap)
        int log_size = 0;
        struct stat buf;
        char str[256];
-       char strtime[40];
+       char strtime[64];
 
        if (!log_file)
                log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
@@ -168,7 +172,11 @@ void __connman_log_s(int log_priority, const char *format, ...)
 
        va_start(ap, format);
 
-       vsyslog(LOG_DEBUG, format, ap);
+       if (dlog_logging)
+               dlog_vprint(DLOG_DEBUG, LOG_TAG, format, ap);
+
+       if (file_logging)
+               vsyslog(LOG_DEBUG, format, ap);
 
        va_end(ap);
 }
@@ -189,7 +197,12 @@ void connman_info(const char *format, ...)
        va_list ap;
 
        va_start(ap, format);
+#if defined TIZEN_EXT
+       if (dlog_logging)
+               dlog_vprint(DLOG_INFO, LOG_TAG, format, ap);
 
+       if (file_logging)
+#endif
        vsyslog(LOG_INFO, format, ap);
 
        va_end(ap);
@@ -207,7 +220,12 @@ void connman_warn(const char *format, ...)
        va_list ap;
 
        va_start(ap, format);
+#if defined TIZEN_EXT
+       if (dlog_logging)
+               dlog_vprint(DLOG_WARN, LOG_TAG, format, ap);
 
+       if (file_logging)
+#endif
        vsyslog(LOG_WARNING, format, ap);
 
        va_end(ap);
@@ -225,7 +243,12 @@ void connman_error(const char *format, ...)
        va_list ap;
 
        va_start(ap, format);
+#if defined TIZEN_EXT
+       if (dlog_logging)
+               dlog_vprint(DLOG_ERROR, LOG_TAG, format, ap);
 
+       if (file_logging)
+#endif
        vsyslog(LOG_ERR, format, ap);
 
        va_end(ap);
@@ -243,7 +266,12 @@ void connman_debug(const char *format, ...)
        va_list ap;
 
        va_start(ap, format);
+#if defined TIZEN_EXT
+       if (dlog_logging)
+               dlog_vprint(DLOG_DEBUG, LOG_TAG, format, ap);
 
+       if (file_logging)
+#endif
        vsyslog(LOG_DEBUG, format, ap);
 
        va_end(ap);
index 0700304..ae17723 100755 (executable)
@@ -104,6 +104,9 @@ static struct {
        char *global_nameserver;
        bool supplicant_debug;
        char *def_wifi_ifname;
+       bool file_log;
+       bool dlog_log;
+       bool simplified_log;
 #endif
 } connman_settings  = {
        .bg_scan = true,
@@ -134,6 +137,9 @@ static struct {
        .global_nameserver = NULL,
        .supplicant_debug = false,
        .def_wifi_ifname = DEFAULT_WIFI_INTERFACE,
+       .file_log = true,
+       .dlog_log = true,
+       .simplified_log = true,
 #endif
 };
 
@@ -221,6 +227,9 @@ static struct {
 #define CONF_GLOBAL_NAMESERVER          "GlobalNameserver"
 #define CONF_CONNMAN_SUPPLICANT_DEBUG   "ConnmanSupplicantDebug"
 #define CONF_CONNMAN_WIFI_DEF_IFNAME    "DefaultWifiInterface"
+#define CONF_CONNMAN_FILE_LOG           "FileLogging"
+#define CONF_CONNMAN_DLOG_LOG           "DlogLogging"
+#define CONF_CONNMAN_SIMPLIFIED_LOG     "SimplifiedLog"
 #endif
 
 #if defined TIZEN_EXT
@@ -279,6 +288,9 @@ static const char *supported_options[] = {
        CONF_GLOBAL_NAMESERVER,
        CONF_CONNMAN_SUPPLICANT_DEBUG,
        CONF_CONNMAN_WIFI_DEF_IFNAME,
+       CONF_CONNMAN_FILE_LOG,
+       CONF_CONNMAN_DLOG_LOG,
+       CONF_CONNMAN_SIMPLIFIED_LOG,
 #endif
        NULL
 };
@@ -666,6 +678,27 @@ static void check_Tizen_configuration(GKeyFile *config)
 
        g_clear_error(&error);
 
+       boolean = __connman_config_get_bool(config, "General",
+                       CONF_CONNMAN_FILE_LOG, &error);
+       if (!error)
+               connman_settings.file_log = boolean;
+
+       g_clear_error(&error);
+
+       boolean = __connman_config_get_bool(config, "General",
+                       CONF_CONNMAN_DLOG_LOG, &error);
+       if (!error)
+               connman_settings.dlog_log = boolean;
+
+       g_clear_error(&error);
+
+       boolean = __connman_config_get_bool(config, "General",
+                       CONF_CONNMAN_SIMPLIFIED_LOG, &error);
+       if (!error)
+               connman_settings.simplified_log = boolean;
+
+       g_clear_error(&error);
+
        check_Tizen_INS_configuration(config);
 }
 
@@ -907,7 +940,11 @@ static int config_init(const char *file)
        parse_config(config);
        if (config)
                g_key_file_free(config);
-
+#if defined TIZEN_EXT
+       dlog_logging = connman_settings.file_log;
+       file_logging = connman_settings.dlog_log;
+       simplified_log = connman_settings.simplified_log;
+#endif
        return 0;
 }
 
@@ -1134,6 +1171,15 @@ bool connman_setting_get_bool(const char *key)
 
        if (g_str_equal(key, CONF_CONNMAN_SUPPLICANT_DEBUG))
                return connman_settings.supplicant_debug;
+
+       if (g_str_equal(key, CONF_CONNMAN_FILE_LOG))
+               return connman_settings.file_log;
+
+       if (g_str_equal(key, CONF_CONNMAN_DLOG_LOG))
+               return connman_settings.dlog_log;
+
+       if (g_str_equal(key, CONF_CONNMAN_SIMPLIFIED_LOG))
+               return connman_settings.simplified_log;
 #endif
 
 #if defined TIZEN_EXT
index 58bcfcb..555225f 100755 (executable)
@@ -172,6 +172,15 @@ NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w
 # Enable supplicant debugging log
 ConnmanSupplicantDebug = false
 
+# Save ConnMan log to file
+FileLogging = false
+
+# Use dlog for ConnMan logging
+DlogLogging = true
+
+# Some logs of low importance are omitted to reduce the amount of logs
+SimplifiedLog = true
+
 # This value specifies which will be the default when there are multiple wifi interfaces.
 # Default value is wlan0.
 DefaultWifiInterface = wlan0
index 636da18..281d020 100755 (executable)
@@ -1169,7 +1169,9 @@ static int network_probe(struct connman_network *network)
                        driver = NULL;
                        continue;
                }
-
+#if defined TIZEN_EXT
+               if (!simplified_log)
+#endif
                DBG("driver %p name %s", driver, driver->name);
 
                if (driver->probe(network) == 0)
@@ -2110,7 +2112,9 @@ int __connman_network_connect(struct connman_network *network)
 int __connman_network_disconnect(struct connman_network *network)
 {
        int err = 0;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p", network);
 
        remove_ipv4ll_timeout(network);
@@ -2341,7 +2345,9 @@ int connman_network_set_bssid(struct connman_network *network,
 
        if (bssid == NULL)
                return -EINVAL;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p bssid %02x:%02x:%02x:%02x:%02x:%02x", network,
                        bssid[0], bssid[1], bssid[2],
                        bssid[3], bssid[4], bssid[5]);
@@ -2433,6 +2439,9 @@ int connman_network_set_enc_mode(struct connman_network *network,
        if (encryption_mode == NULL)
                return -EINVAL;
 
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p encryption mode %s", network, encryption_mode);
 
        g_strlcpy(network->wifi.encryption_mode, encryption_mode,
@@ -2526,6 +2535,9 @@ int connman_network_set_countrycode(struct connman_network *network,
        if (country_code == NULL)
                return -EINVAL;
 
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p Country Code %02x:%02x",network,
            country_code[0],country_code[1]);
 
@@ -2552,6 +2564,9 @@ int connman_network_set_bssid_list(struct connman_network *network,
 int connman_network_set_phy_mode(struct connman_network *network,
                                    ieee80211_modes_e mode)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p phy mode %d", network, mode);
        network->wifi.phy_mode = mode;
 
@@ -2684,6 +2699,9 @@ int connman_network_set_domain(struct connman_network *network,
 int connman_network_set_name(struct connman_network *network,
                                                        const char *name)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p name %s", network, name);
 
        g_free(network->name);
index 2b40dec..99f52e0 100755 (executable)
@@ -860,6 +860,9 @@ static int service_ext_load(struct connman_service *service)
        int i;
        int err = 0;
 
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p", service);
 
        if (!service->network)
@@ -1036,7 +1039,9 @@ static int service_load(struct connman_service *service)
 #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
        bool use_eapol;
 #endif
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p", service);
 
        keyfile = connman_storage_load_service(service->identifier);
@@ -6259,6 +6264,9 @@ static void preferred_tech_add_by_type(gpointer data, gpointer user_data)
                tech_data->preferred_list =
                        g_list_append(tech_data->preferred_list, service);
 
+#if defined TIZEN_EXT
+               if (!simplified_log)
+#endif
                DBG("type %d service %p %s", tech_data->type, service,
                                service->name);
        }
@@ -7053,6 +7061,9 @@ static void service_append_added_foreach(gpointer data, gpointer user_data)
                append_struct(service, iter);
                g_hash_table_remove(services_notify->add, service->path);
        } else {
+#if defined TIZEN_EXT
+               if (!simplified_log)
+#endif
                DBG("changed %s", service->path);
 
                append_struct_service(iter, NULL, service);
@@ -7261,6 +7272,9 @@ static DBusMessage *downgrade_service(DBusConnection *conn,
 
 static void service_schedule_added(struct connman_service *service)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p", service);
 
        g_hash_table_remove(services_notify->remove, service->path);
@@ -7454,6 +7468,9 @@ static void stats_init(struct connman_service *service)
 
 static void service_initialize(struct connman_service *service)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p", service);
 
        service->refcount = 1;
@@ -9960,7 +9977,9 @@ static struct connman_service *service_get(const char *identifier)
        service = connman_service_create();
        if (!service)
                return NULL;
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p", service);
 
        service->identifier = g_strdup(identifier);
@@ -9975,6 +9994,9 @@ static struct connman_service *service_get(const char *identifier)
 
 static int service_register(struct connman_service *service)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("service %p", service);
 
        if (service->path)
@@ -9992,7 +10014,7 @@ static int service_register(struct connman_service *service)
        if (ret == -ERANGE)
                service_ext_save(service);
        ret = __connman_config_provision_service(service);
-       if (ret < 0)
+       if (ret < 0 && simplified_log)
                DBG("Failed to provision service");
 #else
        if (__connman_config_provision_service(service) < 0)
@@ -10608,7 +10630,8 @@ void __connman_service_notify_strength_changed(struct connman_network *network)
                return;
 
        service->strength = strength;
-       DBG("Strength %d", strength);
+       if (!simplified_log)
+               DBG("Strength %d", strength);
        strength_changed(service);
        service_list_sort();
 }
index 32f1b01..ac99f76 100755 (executable)
@@ -106,9 +106,11 @@ static void resolv_result(GResolvResultStatus status, char **results,
        server = g_strdup((gchar *)user_data);
        ts_list = g_slist_append(ts_list, server);
 
-       DBG("added server %s", server);
-#endif
+       if (!simplified_log)
+               DBG("added server %s", server);
 
+       if (!simplified_log)
+#endif
        DBG("status %d", status);
 
        if (status == G_RESOLV_RESULT_STATUS_SUCCESS) {
@@ -185,7 +187,9 @@ static void sync_next(void)
                        __connman_ntp_start(ts_current, ntp_callback, NULL);
                        return;
                }
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
                DBG("Resolving timeserver %s", ts_current);
 #if defined TIZEN_EXT
                resolv_id = g_resolv_lookup_hostname(resolv, ts_current,