platform/core/system/dlog.git
5 years agoFix minor issues with log entry parsing 11/195611/1
Michal Bloch [Fri, 14 Dec 2018 18:29:14 +0000 (19:29 +0100)]
Fix minor issues with log entry parsing

Change-Id: I2a566647cdde20aa7168d816afd1c78146567f4f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix missing header inclusion 10/195610/1
Michal Bloch [Fri, 14 Dec 2018 18:28:27 +0000 (19:28 +0100)]
Fix missing header inclusion

`get_proper_clock` returns `clockid_t` which requires <time.h>

Change-Id: I40c6416246cde0d2033b80bf8eb7219f3500fb77
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: test tag based dynamic filters 40/195440/3
Maciej Slodczyk [Thu, 13 Dec 2018 11:43:18 +0000 (12:43 +0100)]
testsuite: test tag based dynamic filters

Change-Id: Iebea3f70867d117b765737113bead7837bd285f6
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: check if dlogctl denies invalid arguments 36/195336/3
Maciej Slodczyk [Wed, 12 Dec 2018 17:46:43 +0000 (18:46 +0100)]
testsuite: check if dlogctl denies invalid arguments

Change-Id: I7b50ead74478b210e04b1324ed7d2bf0da54d949
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoApply __attribute__((format(printf..))) Warning to Public dlog_print() 38/195438/2 submit/tizen/20181213.113859
Hyotaek Shim [Thu, 13 Dec 2018 11:33:42 +0000 (20:33 +0900)]
Apply __attribute__((format(printf..))) Warning to Public dlog_print()

In public rootstrap, dlog-internal.h is removed.
So,
"#pragma GCC diagnostic warning "-Wformat"" will be applied instead of
"#pragma GCC diagnostic error "-Wformat""

Change-Id: I56beb06ac1cdb17fee45411e32f058f56b743bba
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agotests: add libdlog base unit tests 41/195341/1
Michal Bloch [Tue, 11 Dec 2018 19:33:19 +0000 (20:33 +0100)]
tests: add libdlog base unit tests

Change-Id: I9d489ed607d9917aaf782339b7db700259955ac9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fix reconstruction after destruction 40/195340/1
Michal Bloch [Mon, 10 Dec 2018 10:59:59 +0000 (11:59 +0100)]
libdlog: fix reconstruction after destruction

Change-Id: Ib3409ce958d6c936f9a44e337bbec50d36117d02
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: test filters added by dlogctl 34/195334/2
Maciej Slodczyk [Wed, 12 Dec 2018 16:54:19 +0000 (17:54 +0100)]
testsuite: test filters added by dlogctl

Change-Id: I3309ee558a3549438aa9a45bf17ab2ff03a184de
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoutil: fix dlogutil failing with multiple buffers 35/195335/2
Maciej Slodczyk [Wed, 12 Dec 2018 16:57:00 +0000 (17:57 +0100)]
util: fix dlogutil failing with multiple buffers

Change-Id: Ia0375c7118194dddb51725af3cdfea3065de353f
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: make sure proper values are returned when testing filters 30/195330/2
Maciej Slodczyk [Wed, 12 Dec 2018 13:03:47 +0000 (14:03 +0100)]
testsuite: make sure proper values are returned when testing filters

Change-Id: I08200630ea299c71865f06da09a235ed395d533d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: extend dynamic filters tests 29/195329/2
Maciej Slodczyk [Wed, 12 Dec 2018 12:59:38 +0000 (13:59 +0100)]
testsuite: extend dynamic filters tests

Dynamic filters directory SMACK label is now tested,
as well as alternative filters config file.

Change-Id: I3d2879885c87991965fab65339c68f0b05d9ab18
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoshared: add log_config_copy & log_config_remove 05/195105/6
Michal Bloch [Tue, 11 Dec 2018 18:03:59 +0000 (19:03 +0100)]
shared: add log_config_copy & log_config_remove

The former copies a config structure and the latter removes
an entry under given key. Includes unit tests for both.

Change-Id: Ideca55a2b9fe9d0b038675e06f5ace72d12af78a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add libdlog Android Logger unit tests 78/195078/2
Michal Bloch [Fri, 7 Dec 2018 16:29:02 +0000 (17:29 +0100)]
tests: add libdlog Android Logger unit tests

Change-Id: Ib529daa9fb8fff828c0255bdd871bf81b7263158
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add libdlog-pipe unit tests 66/194866/4
Michal Bloch [Fri, 7 Dec 2018 12:23:00 +0000 (13:23 +0100)]
tests: add libdlog-pipe unit tests

Change-Id: I7f25900125ba5901a527c6a1268a39e3d68c3710
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog pipe: fix correctness checks 65/194865/2
Michal Bloch [Fri, 7 Dec 2018 12:21:22 +0000 (13:21 +0100)]
libdlog pipe: fix correctness checks

 * rejects on negative buffer ID (no longer crashes)
 * rejects relative socket paths
 * accepts maximal payloads

Change-Id: I7344cf4d47eb65c98a65a01ad4ada38ca9c9b5fd
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fail early on long pipe paths 64/194864/2
Michal Bloch [Fri, 30 Nov 2018 11:42:08 +0000 (12:42 +0100)]
libdlog: fail early on long pipe paths

Change-Id: I779b8427db928c8dc29174b508194cbd38561329
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix `log_config_free` corrupting the config 18/195218/3
Michal Bloch [Tue, 11 Dec 2018 18:03:22 +0000 (19:03 +0100)]
Fix `log_config_free` corrupting the config

It used to leave the config in a corrupt state that
referenced freed memory and leaked any added entries.
This did not cause any actual problems because no
config structure was ever reused in production code,
only in tests which do that for convenience.

Change-Id: I90a52c31ca2985ab9c67b32849bca426fb3f1ed7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRevert "Apply __attribute__((format(printf..))) to Public dlog_print()" 46/195246/2
Hyotaek Shim [Wed, 12 Dec 2018 02:20:51 +0000 (02:20 +0000)]
Revert "Apply __attribute__((format(printf..))) to Public dlog_print()"

This reverts commit 6b5b9d0c435fa4b79395e22bc8ba39eedee3f0c0.

Change-Id: Id7739408a38f86f78ddaa12e93e42de2cc208a8d

5 years agodlogutil: allow printing current DLog version 77/195177/2
Maciej Slodczyk [Mon, 10 Dec 2018 15:20:38 +0000 (16:20 +0100)]
dlogutil: allow printing current DLog version

Change-Id: I49c1d4cf5c5bd725c9d516414e7fbd0774f2af8d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMerge "dlogctl: allow empty priority when printing limits" into tizen
Maciej Slodczyk [Tue, 11 Dec 2018 08:32:11 +0000 (08:32 +0000)]
Merge "dlogctl: allow empty priority when printing limits" into tizen

5 years agoMerge "dlogsend: notify and return error code when message send fails" into tizen
Maciej Slodczyk [Tue, 11 Dec 2018 08:32:04 +0000 (08:32 +0000)]
Merge "dlogsend: notify and return error code when message send fails" into tizen

5 years agoFix compilation errors 01/195101/2
Michal Bloch [Mon, 10 Dec 2018 15:32:33 +0000 (16:32 +0100)]
Fix compilation errors

 * `malloc` requires `stdlib.h`
 * case labels only accept constants, not variables (even static const)

Change-Id: Ie508947abd79e6d3b47a08f63cb07dbf8463dd72
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogsend: notify and return error code when message send fails 09/193809/5
Maciej Slodczyk [Mon, 26 Nov 2018 13:18:34 +0000 (14:18 +0100)]
dlogsend: notify and return error code when message send fails

Change-Id: I3545f90ef57a71e93ee59977d185d8c90306170b
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agodlogctl: allow empty priority when printing limits 61/194061/8
Maciej Slodczyk [Wed, 28 Nov 2018 14:54:44 +0000 (15:54 +0100)]
dlogctl: allow empty priority when printing limits

Change-Id: If2ed606bc3f99ba03cb87974f5ec7e09a2c3121b
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoApply __attribute__((format(printf..))) to Public dlog_print() 43/194943/1
Hyotaek Shim [Mon, 10 Dec 2018 03:01:35 +0000 (12:01 +0900)]
Apply __attribute__((format(printf..))) to Public dlog_print()

to check format even for variable arguments (...)

format (printf, string-index, first-to-check)
- string-index : format string index (starting from 1)
- first-to-check : first argument index to be checked
https://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Function-Attributes.html#Function-Attributes

Change-Id: I852fcea60109517e50e26e3ee1a8064fd9bb649f
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoApply __attribute__((format(printf..))) to internal __dlog_print() 81/194581/2 submit/tizen/20181207.015822
Hyotaek Shim [Thu, 6 Dec 2018 04:42:39 +0000 (13:42 +0900)]
Apply __attribute__((format(printf..))) to internal __dlog_print()

to check format even for variable arguments (...)

format (printf, string-index, first-to-check)
- string-index : format string index (starting from 1)
- first-to-check : first argument index to be checked
https://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Function-Attributes.html#Function-Attributes

Change-Id: I70ee2d0687c87b4f15f46dd962c249136d27709f
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agotests: add libdlog dynamic config unit tests 62/194262/2 accepted/tizen/unified/20181205.063352 submit/tizen/20181204.070128
Michal Bloch [Fri, 30 Nov 2018 10:37:00 +0000 (11:37 +0100)]
tests: add libdlog dynamic config unit tests

Change-Id: I120962c2b83f05d52487a955abd8731119e57b0d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
(cherry picked from commit 8d4febbb4cbf3e7d322560ae7a438fd11b8d2954)

5 years agolibdlog: treat inotify creation errors as a failure 61/194261/1
Michal Bloch [Fri, 30 Nov 2018 10:36:19 +0000 (11:36 +0100)]
libdlog: treat inotify creation errors as a failure

Change-Id: I7abcfcf606fbd32c9b6806e6bab557ee6155a9e5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: don't report coverage of tests themselves 71/194071/3
Michal Bloch [Wed, 28 Nov 2018 20:16:34 +0000 (21:16 +0100)]
tests: don't report coverage of tests themselves

Counting test cases themselves in the report just inflates the coverage
since they tend to have a lot of lines that are executed unconditionally.

Change-Id: I74f961fb8432bbfef06fa522e06aad650ad94a6c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoUse the actual bool type instead of a fake enum 44/193944/2
Michal Bloch [Tue, 27 Nov 2018 18:20:07 +0000 (19:20 +0100)]
Use the actual bool type instead of a fake enum

Improves type correctness and fixes a case of two functions
being identical - `log_config_get_boolean` used to just call
`log_config_get_int` with the same parameters and did not
even touch the return value.

Includes tests for `log_config_get_boolean`.

Change-Id: I185dfac32d40bcab3ddbf95d3b4536c2d275098e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: complete ptrs_list unit tests 70/194070/2 accepted/tizen/unified/20181130.064916 submit/tizen/20181129.005631
Michal Bloch [Wed, 28 Nov 2018 18:04:04 +0000 (19:04 +0100)]
tests: complete ptrs_list unit tests

Add tests for `list_clear_free_contents`, the last untested func.
Also improve type correctness.

Change-Id: I4ccc62268757b990e1462a9af9f76f7084848177
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: read /dev/kmsg in a throttled loop 26/193726/3
Michal Bloch [Thu, 22 Nov 2018 19:17:42 +0000 (20:17 +0100)]
dlog_logger: read /dev/kmsg in a throttled loop

KMSG only returns one entry per read() - do it in a throttled loop
for efficiency. This is similar to how Android Logger devices are
handled.

Change-Id: I0f95dc657898a9d68bcfd96f9d2e2daab5814176
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: make sure all buffers are disabled when testing 64/194064/1
Maciej Slodczyk [Wed, 28 Nov 2018 16:25:35 +0000 (17:25 +0100)]
testsuite: make sure all buffers are disabled when testing

Change-Id: Ic48475b7862ffae7d7d1263fce885f31f68a0d16
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotests: add libdlog limiter unit tests 37/193937/1
Michal Bloch [Mon, 26 Nov 2018 16:29:33 +0000 (17:29 +0100)]
tests: add libdlog limiter unit tests

Change-Id: I8dacfcf606fbd32c9b6806e6bab557ee6155a9e5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolimiter: fix internal priority mapping 08/193908/1
Michal Bloch [Tue, 27 Nov 2018 10:11:23 +0000 (11:11 +0100)]
limiter: fix internal priority mapping

Now makes sure the result is one of the chars "?*VDIWEFS".

Previously it could return lowercase characters, numerical
characters (except '8' which stands for SILENT but including
'1' which stands for DEFAULT which is not a real priority),
or the null character (when passed the integers 0 or 1).

Change-Id: I3766d699e553d71265a979ababe59fccdd16d571
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix a missing include 07/193907/1
Michal Bloch [Mon, 26 Nov 2018 16:35:12 +0000 (17:35 +0100)]
Fix a missing include

`stddef.h` is needed for `size_t`, which is
one of the arguments to `__log_limiter_dump_rule`.

Change-Id: Iffbf5666dbfffe26ac1214e0068628ecfb5dd789
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: reduce pipe size 1 MB → 64 kB 90/193790/2 accepted/tizen/unified/20181127.133459 submit/tizen/20181127.023050
Michal Bloch [Mon, 26 Nov 2018 10:36:39 +0000 (11:36 +0100)]
libdlog: reduce pipe size 1 MB → 64 kB

It seems that the amount of memory allocated specifically to pipes
can be limited and on most targets it seems to be set to 16k pages,
that is, 64 MB raw memory. Pipes are currently very aggressively
sized which burns through this limit easily. 64 kB is still quite
a lot and should not cause any problems to prolific loggers while
heavily culling memory wastage.

Change-Id: I5465de849a279e23ca0d6bae34bceddd6136db16
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix pipe resize failure being considered an error 95/193795/2
Michal Bloch [Mon, 26 Nov 2018 11:00:57 +0000 (12:00 +0100)]
Fix pipe resize failure being considered an error

Pipes are enlarged so that prolific logging does not clog the pipe,
which is just an optimisation - logging can still continue if it
fails (albeit slower).

Change-Id: I5218512d3b22eea1636460ed463eeb2280faa9e7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoBuild process: create a test coverage report 26/193826/2
Michal Bloch [Mon, 26 Nov 2018 12:57:45 +0000 (13:57 +0100)]
Build process: create a test coverage report

Uses LCOV to assemble a HTML report in the build directory.

Change-Id: I990d3d59b5fcb500708688c06e7f9a6573e39255
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add dlogctl buffer toggling tests 23/193723/2
Michal Bloch [Fri, 23 Nov 2018 13:15:24 +0000 (14:15 +0100)]
tests: add dlogctl buffer toggling tests

Change-Id: Ibbdfbc938799230cf3e036d7274bf9ffdc9b0e1e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: test misc utility stuff from logcommon.h 34/193734/3
Michal Bloch [Fri, 23 Nov 2018 17:18:10 +0000 (18:18 +0100)]
tests: test misc utility stuff from logcommon.h

Change-Id: Ib8ea673ae9eeae990dcfe8e998fc8383df3c8bae

5 years agotests: add daemon file descriptor checks 18/193718/1
Michal Bloch [Fri, 23 Nov 2018 11:41:22 +0000 (12:41 +0100)]
tests: add daemon file descriptor checks

Checks whether the daemon crashes with low FD limit
and whether it leaks any FDs.

Change-Id: I7352a0e71b5e066ad4600854f34d6bc67375df40
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: cleanup programs when no longer needed 17/193717/1
Michal Bloch [Fri, 23 Nov 2018 11:41:35 +0000 (12:41 +0100)]
tests: cleanup programs when no longer needed

Change-Id: I5cbe9a0723d7cecc657198fb716e78256c5bbde9

5 years agodlogctl: fix -s working as -c if without -t or -p 36/193536/1 accepted/tizen/unified/20181123.063254 submit/tizen/20181122.055216
Michal Bloch [Wed, 21 Nov 2018 13:37:54 +0000 (14:37 +0100)]
dlogctl: fix -s working as -c if without -t or -p

Change-Id: Icf3dfee19d51a7312c4f392424774904622dd24e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogctl: add --clear / -c 68/193268/4 accepted/tizen/unified/20181121.060500 submit/tizen/20181120.234806
Michal Bloch [Fri, 16 Nov 2018 14:53:04 +0000 (15:53 +0100)]
dlogctl: add --clear / -c

Without any parameters, clears all rules. With just one of -t or -p
supplied, the other is assumed to be '*' (same logic as -g).

The argument to the -s option is now mandatory.

Change-Id: I3ec152e49076f58b1f052e4c21c32fcee0deff56
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogctl: add a parameter correctness check 49/193449/2
Michal Bloch [Tue, 20 Nov 2018 10:58:24 +0000 (11:58 +0100)]
dlogctl: add a parameter correctness check

Now `-g -s 123 --disable` is disallowed.

Change-Id: I9b8163e21cbc9c4fe1d20d2d3c58d289cfb0f640
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: commentary for the recent epoll fixes 46/193246/2
Michal Bloch [Thu, 15 Nov 2018 15:47:25 +0000 (16:47 +0100)]
dlog_logger: commentary for the recent epoll fixes

Some of the recent epoll changes needed an explanation
since it wasn't immediately obvious how they work.

Change-Id: Idecadedcd8bf8a570f65c602d7dbf11e971360f3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: fix writing to files 82/193182/1 accepted/tizen/unified/20181119.013237 submit/tizen/20181116.003516
Michal Bloch [Thu, 15 Nov 2018 15:47:25 +0000 (16:47 +0100)]
dlog_logger: fix writing to files

Change-Id: I172cb2dcd8bf8a570f65c602d7dbf11e971360f3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: filters the `apps` buffer by default 10/193110/2 accepted/tizen/unified/20181115.151619 submit/tizen/20181115.015729
Michal Bloch [Wed, 14 Nov 2018 14:51:58 +0000 (15:51 +0100)]
libdlog: filters the `apps` buffer by default

Change-Id: Ie89cd6f5f660cc831aa55e95db7181720fca9191
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoMerge "libdlog: enable dynamic filters by default" into tizen
Hyotaek Shim [Thu, 15 Nov 2018 01:48:25 +0000 (01:48 +0000)]
Merge "libdlog: enable dynamic filters by default" into tizen

5 years agoMerge "dlog_logger: reuse clock readings" into tizen
Hyotaek Shim [Thu, 15 Nov 2018 01:42:08 +0000 (01:42 +0000)]
Merge "dlog_logger: reuse clock readings" into tizen

5 years agolibdlog: fix a dynamic config crash 07/193107/1
Michal Bloch [Wed, 14 Nov 2018 15:09:59 +0000 (16:09 +0100)]
libdlog: fix a dynamic config crash

Change-Id: I83867775088438636cf483a14616b8ef49106a84
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: enable dynamic filters by default 04/193104/2
Michal Bloch [Wed, 14 Nov 2018 14:34:07 +0000 (15:34 +0100)]
libdlog: enable dynamic filters by default

Change-Id: I8f9a6ec4ab2d99c3bf4c4e36c6790db744747889
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: reuse clock readings 03/193103/1
Michal Bloch [Wed, 14 Nov 2018 14:29:33 +0000 (15:29 +0100)]
dlog_logger: reuse clock readings

No need for every reader to read the same value on its own.

Change-Id: I91f0e81306061607cb848911bafaf69554b15229
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: improve reader epoll registration 29/192129/4 accepted/tizen/5.0/unified/20181113.090059 accepted/tizen/unified/20181113.085958 submit/tizen/20181112.002448 submit/tizen_5.0/20181112.002456
Michal Bloch [Mon, 29 Oct 2018 16:54:28 +0000 (17:54 +0100)]
dlog_logger: improve reader epoll registration

 * now keeps readers registered with EPOLLHUP for
   immediate removal when the other end gets closed

 * no longer attempts to unregister already unregistered FDs

Change-Id: If5a28be45158896a174ab90259648602af594b92
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRelease 5.0.4 05/192205/2 accepted/tizen/unified/20181105.143907 submit/tizen/20181031.151907
Michal Bloch [Wed, 31 Oct 2018 13:45:42 +0000 (14:45 +0100)]
Release 5.0.4

Contains various fixes:
 * fix dynamic config not rejecting relative paths
 * fix libdlog not closing FDs on exec() under Android Logger backend
 * fix removal of the dynamic config file being unhandled
 * fix treating log limitation as an error

Also:
 * increase the daemon's FD limit from 1K to 16K
 * optimize dlogutil's dumping mode performance

Change-Id: Ic3ac0ab254490268698af46da73723e963edd57a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger daemon: reaching FD limit leaves a log 99/191999/5
Michal Bloch [Fri, 26 Oct 2018 10:31:25 +0000 (12:31 +0200)]
dlog_logger daemon: reaching FD limit leaves a log

Change-Id: Ie70e7fa6e1fe5a3c394e0fd428cf0aa3375e03aa
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoMerge "limiter: do not treat limiter restrictions as an error" into tizen
Maciej Slodczyk [Mon, 29 Oct 2018 11:30:37 +0000 (11:30 +0000)]
Merge "limiter: do not treat limiter restrictions as an error" into tizen

5 years agoMerge "Handle deleting dynamic configuration file" into tizen
Maciej Slodczyk [Mon, 29 Oct 2018 10:51:35 +0000 (10:51 +0000)]
Merge "Handle deleting dynamic configuration file" into tizen

5 years agolimiter: do not treat limiter restrictions as an error 65/191865/6
Maciej Slodczyk [Wed, 24 Oct 2018 15:54:04 +0000 (17:54 +0200)]
limiter: do not treat limiter restrictions as an error

Currently when a log is blocked by limiter rules,
dlog_print() returns an error code. Let it be blocked,
but return a success code - number of written bytes
(which is 0).

Change-Id: Ie37e3d0e17f0fa3cd9fef012412270bdce8565e2
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoIncrease the limit of open files from 1K to 16K in dlog_logger 76/191976/2
Hyotaek Shim [Fri, 26 Oct 2018 08:07:19 +0000 (17:07 +0900)]
Increase the limit of open files from 1K to 16K in dlog_logger

Change-Id: Ib334e7762099fef2008adec29da9120115764b19
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoHandle deleting dynamic configuration file 81/191781/2
Maciej Slodczyk [Tue, 23 Oct 2018 14:33:55 +0000 (16:33 +0200)]
Handle deleting dynamic configuration file

It's no longer an error when a dynamic configuration
file is deleted - restore default values both for plog and
filters in that case.

Change-Id: I3ec06aeba50f2e74bfee90736beeb5634d79e06d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMerge "dynamic config: fail on relative paths" into tizen
Maciej Slodczyk [Mon, 22 Oct 2018 14:37:06 +0000 (14:37 +0000)]
Merge "dynamic config: fail on relative paths" into tizen

5 years agolibdlog: close Android Logger connections on exec 06/191706/1
Michal Bloch [Mon, 22 Oct 2018 12:16:18 +0000 (14:16 +0200)]
libdlog: close Android Logger connections on exec

Change-Id: Ib6576073f3c0c7f224a9d0c9605f879a9f347cd0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodynamic config: fail on relative paths 02/191702/1
Michal Bloch [Mon, 22 Oct 2018 10:25:11 +0000 (12:25 +0200)]
dynamic config: fail on relative paths

Change-Id: I50ca411b3268fdc25d1cb58a19f1dc8aa9752bbb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: optimize dumping instance timezone handling 02/191502/2
Michal Bloch [Wed, 17 Oct 2018 12:08:39 +0000 (14:08 +0200)]
util: optimize dumping instance timezone handling

  We can assume that such instances will not see a timezone
  change happen during their lifetime, and even if they do,
  it is probably best if they ignore it (a dump would ideally
  behave as if it was atomic). This means we can optimize the
  behaviour where printing the timestamp requires us to check
  whether the timezone changed, which involves calling stat()
  on /etc/localtime, which is not cheap on its own and made
  even worse when multiple symlinks are involves.

  glibc has a feature where setting the TZ environmental var
  will cache the timezone, achieving precisely what we want.

Change-Id: I2f5e26a4be81b8f846036282fc1a0bfe02b70b48
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRelease 5.0.3 57/191657/1 submit/tizen/20181019.192244
Michal Bloch [Fri, 19 Oct 2018 19:11:10 +0000 (21:11 +0200)]
Release 5.0.3

Contains fixes and documentation for the recently added
dynamic configuration features:

 * the dlog-doc package now contains a usage guide describing
   the new feature with examples and common mistakes

 * fixed disabling dynamic configuration turning the limiter off as well

 * fixed disabling all buffers being permanent

 * fixed logs being able to slip through a disabled buffer

 * fixed dynamic config behaviour with forked processes

And some miscellaneous fixes:

 * fixed some resource leak and corruption issues

 * fixed some spurious static analysis warnings

 * fixed the config being needlessly read twice by libdlog

 * fixed the daemon not noticing timezone changes for the purpose
   of writing log files (on both backends)

Change-Id: I7acdc373c7acb5ae0b06bc0fe12ad507fd327d30
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: Do not remove the dynamic filter watch in library destructor 55/191655/3
Karol Lewandowski [Fri, 19 Oct 2018 19:07:44 +0000 (21:07 +0200)]
libdlog: Do not remove the dynamic filter watch in library destructor

Calling inotify_rm_watch() on inotify fd will remove watches for
all processes that share that inotify fd. This means that every
process that uses dlog and forks will have the dynamic config
feature broken.

This commit fixes that by removing the erroneous rm_watch.

Change-Id: If023d75937b5b435e2188aca7f70b57ce964c767

5 years agodocumentation: describe some common mistakes 56/191656/1
Michal Bloch [Fri, 19 Oct 2018 18:56:15 +0000 (20:56 +0200)]
documentation: describe some common mistakes

Change-Id: Ib18b454042a50152bc0815fe42780d2fb8a05004
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFurther documentation improvements 07/191407/3
Michal Bloch [Tue, 16 Oct 2018 12:49:05 +0000 (14:49 +0200)]
Further documentation improvements

 * fix some mistakes in the previous documentation commit
 * in particular, make the txt file actually end up in the doc rpm
 * extend config entry documentation
 * remove unused entries

Change-Id: I6f423ee42f5fc26059ee738909208719e4dd6753
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: update timezone at runtime 01/191301/1
Michal Bloch [Mon, 15 Oct 2018 13:40:26 +0000 (15:40 +0200)]
dlog_logger: update timezone at runtime

glibc looks for the existence of the TZ variable and caches the timezone,
preventing extra stat() calls. This saves some performance but also sets
the timezone in stone.

The daemon can afford the performance hit as it is spread gradually over
time.

Change-Id: I15e789a391e7a443c284b4e08d20dd7163eccce5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fix broken limiter with static config 22/191222/1
Michal Bloch [Fri, 12 Oct 2018 14:23:39 +0000 (16:23 +0200)]
libdlog: fix broken limiter with static config

Change-Id: I0ecd8c3327ac12133aa2beb402bc1c52d598926b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fix buffer disabling issues 20/191220/1
Michal Bloch [Fri, 12 Oct 2018 14:15:46 +0000 (16:15 +0200)]
libdlog: fix buffer disabling issues

 - fix reenabling a buffer requiring a log to be
   sent to another already enabled buffer

 - fix one log being able to slip through into a
   disabled buffer if was enabled the previous time

Change-Id: I47af64b8a74da31c24472190f2ab22806d16db26
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: don't read the config twice 98/190498/2
Michal Bloch [Tue, 2 Oct 2018 11:29:38 +0000 (13:29 +0200)]
libdlog: don't read the config twice

Change-Id: I6c921f264cec7da77da0918ee94f03493f017424
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix various static analysis warnings. 33/190833/2
Michal Bloch [Fri, 5 Oct 2018 17:17:12 +0000 (19:17 +0200)]
Fix various static analysis warnings.

Change-Id: I2e677130ee43e11abd870bd9647f15bdebde7667
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogctl: documentation 44/190944/1
Michal Bloch [Tue, 9 Oct 2018 14:22:29 +0000 (16:22 +0200)]
dlogctl: documentation

 * the priority parameter is now `--priority`;
   note that `--prio`, as a contraction, is still accepted.

 * the dynamic config entry is now mentioned in `--help`,
   as is `limiter_apply_to_all_buffers`.

 * add a guide/manual on dlogctl to the documentation folder.
   Contains examples and commentary.

Change-Id: I80ce5f687f68d61efd729dffcfe70941c66ba3ab
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoAdd MIT License file 99/190599/1 accepted/tizen/5.0/unified/20181102.020628 accepted/tizen/unified/20181010.061632 submit/tizen/20181005.011712 submit/tizen_5.0/20181101.000004
pr.jung [Thu, 4 Oct 2018 05:02:17 +0000 (14:02 +0900)]
Add MIT License file

Change-Id: I7baea949dc8ffd3a83aca16bddb017fbb91e7f41
Signed-off-by: pr.jung <pr.jung@samsung.com>
5 years agoMerge "dlogctl: add runtime platform logging control" into tizen submit/tizen/20181002.093115
Maciej Slodczyk [Tue, 2 Oct 2018 09:22:57 +0000 (09:22 +0000)]
Merge "dlogctl: add runtime platform logging control" into tizen

5 years agoMerge "Extend the platform logging config values" into tizen
Maciej Slodczyk [Tue, 2 Oct 2018 09:22:55 +0000 (09:22 +0000)]
Merge "Extend the platform logging config values" into tizen

5 years agodlogctl: add runtime platform logging control 48/189648/8
Michal Bloch [Wed, 19 Sep 2018 14:37:36 +0000 (16:37 +0200)]
dlogctl: add runtime platform logging control

The runtime buffer toggling feature can now be exercised using dlogctl.

Example usage:
 $ dlogctl --enable
 $ dlogctl --disable -b main -b system

Change-Id: I1fd6a87b7c1ff74fcdc2c0d4d2985941a3eb7f2d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRemove svace error 37/190337/1 accepted/tizen/unified/20181002.093426 submit/tizen/20181001.071210 submit/tizen/20181002.010047
pr.jung [Mon, 1 Oct 2018 05:32:50 +0000 (14:32 +0900)]
Remove svace error

Change-Id: I6b1b82251e219a980743e7c9cc5e780bb7902dfd
Signed-off-by: pr.jung <pr.jung@samsung.com>
5 years agoMerge "libdlog: separate limiter and dynamic config" into tizen
Michal Bloch [Fri, 28 Sep 2018 14:22:31 +0000 (14:22 +0000)]
Merge "libdlog: separate limiter and dynamic config" into tizen

5 years agoMerge "Rename dynamic filters to dynamic config" into tizen
Michal Bloch [Fri, 28 Sep 2018 14:20:46 +0000 (14:20 +0000)]
Merge "Rename dynamic filters to dynamic config" into tizen

5 years agoExtend the platform logging config values 47/189647/7
Michal Bloch [Fri, 7 Sep 2018 13:50:32 +0000 (15:50 +0200)]
Extend the platform logging config values

  `plog` is a config value which controls whether platform logging is enabled,
  i.e. whether logs are even sent to the respective buffers. This is a global
  setting that affects all libdlog users indiscriminately but is very fast,
  unlike filters which have fine-grained control over who gets to log and how
  much but involve some processing.

 * `enable_X` can now be set to control this per buffer, for example to only
   control the `main` buffer, use `enable_main`. This overrides the global
   default from the `plog` value.

 * this can be set dynamically in the runtime config file, similar to filters.

 * the generic `plog` config value still works as a default for the three
   original buffers (`main`, `system`, `radio`) but can be overridden by
   the per-buffer settings. The `apps` buffer does not obey this setting
   and can only be controlled per-buffer. This is for backward compatibility.

Change-Id: I1c0facfe54e5aebeb28a54c808b93ddd1cff5125
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: separate limiter and dynamic config 32/190032/3
Michal Bloch [Mon, 24 Sep 2018 17:27:49 +0000 (19:27 +0200)]
libdlog: separate limiter and dynamic config

Other dynamic features no longer require limiter to be enabled.

Change-Id: I0cbb8b4b2055397afffb23a0132acbb15b319420
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRename dynamic filters to dynamic config 31/190031/3
Michal Bloch [Mon, 24 Sep 2018 14:34:40 +0000 (16:34 +0200)]
Rename dynamic filters to dynamic config

Filters are just one of the many config entries and there are plans
to make others available in the dynamic API.

So far this is just a rename with no logic changes. In particular,
the dynamic API is still enabled alongside limiter for the time being.
This is to make actual logic changes easier to track.

Change-Id: I39296f07a0fe9f8c36ac244f9b790e16bdaa173c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger daemon: make device throttling value buffer-specific 08/190008/4
Maciej Slodczyk [Tue, 25 Sep 2018 15:42:51 +0000 (17:42 +0200)]
dlog_logger daemon: make device throttling value buffer-specific

Change-Id: Ib8ffca5500d7eed2a9a83ee5621aa7e29fc0de2d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agodlog_logger daemon: configurable device throttling 15/189915/5
Michal Bloch [Fri, 14 Sep 2018 13:53:27 +0000 (15:53 +0200)]
dlog_logger daemon: configurable device throttling

The `logger_dev_throttling` config value controls how many logs
the daemon will try to read at once from an Android Logger device.

Use with caution as this affects how a busy buffer will affect others:
 - a higher value means it is more likely to starve them
 - a lower one means it can lose logs itself

Change-Id: I7e4e67e64782456a8ee7f4467ab46151a435d3ae
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoChange /run/dlog/filters.d permission 23/190123/2
Hyotaek Shim [Thu, 27 Sep 2018 06:21:31 +0000 (15:21 +0900)]
Change /run/dlog/filters.d permission

(Before)
drwxr-xr-x  2 log  log          System::Run

(After)
drwxrwxr-x  2 log  log          System::Shared

...
User::Pkg::org.tizen.privacy-setting System::Run rwxat
^ System::Run rwxat
User System::Run rwxat
User::Shell System::Run rxl
System::TEF System::Run rwxat
System::Privileged System::Run rwxat
_ System::Run rwxat
System System::Run rwxat

...
User::Pkg::org.tizen.privacy-setting System::Shared rxl
User System::Shared rxl
User::Shell System::Shared rxl
System::TEF System::Shared rwxat
System::Privileged System::Shared rwxat
System System::Shared rwxat

/run/dlog/filters.d can only be updated by
1) 'root' shell (System::Privileged)
2) sdbd-forked processes ('log' gid + System)

Change-Id: I25875e09da720ca2d7be08216e1d7b60ee999b36
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
[ Added Smack's transmute xattr to ensure files under filters.d receive appropriate label. ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
5 years agodlogctl: make a cleanup function more generic 46/189646/3 accepted/tizen/unified/20180928.080526 submit/tizen/20180927.030248
Michal Bloch [Mon, 17 Sep 2018 14:31:50 +0000 (16:31 +0200)]
dlogctl: make a cleanup function more generic

There's no reason to limit the "free pointer" cleanup just to `char`.

Change-Id: I6fbca39c0f4e76673977a242ab812b96b53eb883
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogctl: document dump mode in help 76/189676/1
Michal Bloch [Wed, 19 Sep 2018 14:25:35 +0000 (16:25 +0200)]
dlogctl: document dump mode in help

Change-Id: I6855164bb20b0fafa9eb073088351f2cc4d4e780
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoChange /bin/dlogctl permission 23/188923/2
Hyotaek Shim [Wed, 12 Sep 2018 02:04:12 +0000 (11:04 +0900)]
Change /bin/dlogctl permission

-rwxr-x--- log log System::Tools /bin/dlogctl

User System::Tools rx
User::Shell System::Tools rx
System::TEF System::Tools rx
System::Privileged System::Tools rx
System System::Tools rx

Change-Id: If16d7aaa96373748113020c8bdafecceac280714
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoAdd license file on all rpm packages 49/188849/1 accepted/tizen/unified/20180912.061604 submit/tizen/20180911.060541
pr.jung [Tue, 11 Sep 2018 05:47:14 +0000 (14:47 +0900)]
Add license file on all rpm packages

Change-Id: I6f6cf183704a834d5894504d01c07d3a7e5bf943
Signed-off-by: pr.jung <pr.jung@samsung.com>
5 years agoMerge "dlogfilterctl: add information about rule type when dumping" into tizen
Michal Bloch [Thu, 6 Sep 2018 13:16:41 +0000 (13:16 +0000)]
Merge "dlogfilterctl: add information about rule type when dumping" into tizen

5 years agodlogfilterctl: add information about rule type when dumping 40/187940/4
Maciej Slodczyk [Wed, 29 Aug 2018 15:19:34 +0000 (17:19 +0200)]
dlogfilterctl: add information about rule type when dumping

Change-Id: Iae7efbc2150f3dfb73971843438ce12946a27f5a
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agologctl: add long versions of command line options 96/188596/4
Maciej Slodczyk [Thu, 6 Sep 2018 11:04:33 +0000 (13:04 +0200)]
logctl: add long versions of command line options

Change-Id: Iff071d7240d903268b172b28ab87cc7444623bb3
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agofilters: rename dlogfilterctl to dlogctl 94/188594/3
Maciej Slodczyk [Thu, 6 Sep 2018 10:16:09 +0000 (12:16 +0200)]
filters: rename dlogfilterctl to dlogctl

Change-Id: I6dcab12485ca71d9e5ba611d40903334852be24a
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: add extended sorting tests 01/188401/3
Maciej Slodczyk [Tue, 4 Sep 2018 15:27:56 +0000 (17:27 +0200)]
testsuite: add extended sorting tests

dlogutil now sorts by timestamp selected by the format
argument. Add relevant tests to the testsuite.

Change-Id: I4b6877c817e803221e804988c886b912185185e7
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoupgrade: remove unused script files. 96/188496/1
INSUN PYO [Wed, 18 Jul 2018 06:24:49 +0000 (15:24 +0900)]
upgrade: remove unused script files.

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I4e2029364191eec819922c63b79d8fb4e4251005

5 years agoMinor dlogfilterctl dump improvements 94/188294/2 accepted/tizen/unified/20180905.140141 submit/tizen/20180905.013814
Michal Bloch [Mon, 3 Sep 2018 11:56:54 +0000 (13:56 +0200)]
Minor dlogfilterctl dump improvements

 * fix a resource leak
 * make output text consistent with -g

Change-Id: I473198c437bcc6e1476c823deaca7d1170d96e77
Signed-off-by: Michal Bloch <m.bloch@samsung.com>