Skip to content

Commit a83ac84

Browse files
committed
[utbot-logs]
Fixing logging design doc todos
1 parent 2892c2e commit a83ac84

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

docs/InterprocessLogging.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,43 @@ which log message in the same format as described in `utbot-intellij/src/main/re
4646

4747
Sometimes same log entry might be written to log multiple times. At log you will see something like:
4848
```
49-
TODO
49+
13:55:41.204 | INFO | AnalyticsConfigureUtil | PathSelectorType: INHERITORS_SELECTOR
50+
13:55:41.204 | INFO | AnalyticsConfigureUtil | PathSelectorType: INHERITORS_SELECTOR
5051
```
5152

5253
This is because of loggers *additivity* - their full names defines tree structure, and events from children
5354
are visible for parents. For example, following `log4j2.xml` configuration in IDEA will produce such problem:
55+
```xml
56+
...
57+
<Loggers>
58+
<Logger name="org.utbot.intellij" level="info">
59+
<AppenderRef ref="IdeaAppender"/>
60+
</Logger>
61+
<Logger name="org.utbot" level="info">
62+
<AppenderRef ref="IdeaAppender"/>
63+
</Logger>
64+
</Loggers>
65+
...
5466
```
55-
TODO
67+
68+
This happens because `org.utbot` logger is parent for `org.utbot.intellij`, and all events from
69+
`org.utbot.intellij` are also transferred to parent. This is called `additivity`.
70+
71+
The solution is to manually add ```additivity="false"``` tag to all loggers:
72+
```xml
73+
...
74+
<Loggers>
75+
<Logger name="org.utbot.intellij" level="info" additivity="false">
76+
<AppenderRef ref="IdeaAppender"/>
77+
</Logger>
78+
<Logger name="org.utbot" level="info" additivity="false">
79+
<AppenderRef ref="IdeaAppender"/>
80+
</Logger>
81+
</Loggers>
82+
...
5683
```
5784

58-
The solution is to manually add ```additivity="false"``` tag to all loggers.
59-
See `utbot-intellij/src/main/resources/log4j2.xml` for example.
85+
Consider this problem when you manually configure log level and appender for logger.
6086

6187
More information is available [here](https://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity).
6288

0 commit comments

Comments
 (0)