summaryrefslogtreecommitdiffstats
path: root/source/development/debugging.rst
blob: 9b3a46d5be8ffef8d537a183f992a78eec616516 (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
37
38
39
40
41
42
43
44
45
Debugging
=========

**Author:** Pascal Withopf <pascalwithopf1@gmail.com>

Target audience are developers and users who need to debug an error with tests.
For debugging with rsyslog.conf see :doc:`troubleshooting <../troubleshooting/index>`.

Debugging with tests
--------------------

| When you want to solve a specific problem you will probably create a test
| and want to debug with it instead of configuring rsyslog. If you want to
| write a debug log you need to open the file **../rsyslog/tests/diag.sh**
| and delete the **#** in front of the two lines:

| **export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout"**
| **export RSYSLOG_DEBUGLOG="log"**

| A debug log will be written now, but remember to put the **#** back again
| before committing your changes. Otherwise it won't work.

Memory debugging
----------------

| You can't use multiple memory debugger at the same time. This will resort
| in errors. Also remember to undo all changes in diag.sh after you are done,
| because it will also resort in errors if you commit them with your work.

Valgrind
~~~~~~~~

| If you want to use Valgrind you need to enable it for tests.
| To do that open the file **../rsyslog/tests/diag.sh** and delete the **#**
| in front of the line:
| **valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1"**
| This will enable valgrind and you will have extra debugging in your test-suite.log file.

Address sanitizer
~~~~~~~~~~~~~~~~~

| If you want to use address sanitizer you need to set your CFLAGS. Use this command:
| **export CFLAGS="-g -fsanitizer=address"**
| After this is done you need to configure and build rsyslog again, otherwise it won't work.