@@ -79,53 +79,62 @@ In this case, you need to install `log4j-core` and `log4j-slf4j2-impl`.
79
79
80
80
To make things a little bit more tangible, consider the following visualization of a typical Log4j Core installation with bridges for an application:
81
81
82
- .Visualization of a typical Log4j Core installation with SLF4J, JUL, and JPL bridges.
83
- [ditaa ]
82
+ .Visualization of a typical Log4j Core installation with SLF4J, JUL, and JPL bridges
83
+ [plantuml ]
84
84
....
85
- /-----------------------------------------------------------------------------------\
86
- | |
87
- | +------------+ +----------+ +----------+ |
88
- | | | | | | | |
89
- | | v | v | v |
90
- | +-----+-----+ +---------+ +---------+ +----+----+ +-------+ +----+----+ +-------+ |
91
- | | | |{d}c1FF | | | | | |{d}c1FF| | | |{d}c1FF| |
92
- | |Application| |Log4j API| |Library 1| |Library 2| | SLF4J | |Library 3| | JUL | |
93
- | | | | | | | | | | | | | | | |
94
- | +-----------+ +--+------+ +----+----+ +---------+ +---+---+ +---------+ +---+---+ |
95
- | : ^ | : : |
96
- | | | | | | |
97
- | Compile time | | | | | |
98
- \------------------|---|---------|----------------------|---------------------|-----/
99
- | | | | |
100
- | | | /-----/ /-----------/
101
- | | | | |
102
- /----------/ \------+--|----------+-----|---------\ |
103
- | | | | | | |
104
- /-------|---------------------|--|----------|-----|---------|-----|-----------------\
105
- | | | | | | | | Runtime |
106
- | v : | : v : v |
107
- | +----------+ +-----+------+ +----+---------+ +---+--------+ |
108
- | |cGRE | |cYEL | |cYEL | |cYEL | |
109
- | |Log4j Core| |JPL to Log4j| |SLF4J to Log4j| |JUL to Log4j| |
110
- | | | | | | | | | |
111
- | +----------+ +------------+ +--------------+ +------------+ |
112
- | |log4j2.xml| ^ | |
113
- | +----------+ | | |
114
- | | | |
115
- | | | |
116
- | /-------------+--|--/ |
117
- | | | | |
118
- | +----------+-------------|--|---------------------------------------------------+ |
119
- | |JRE v : | |
120
- | | +----+--+ | |
121
- | | |{d}c1FF| | |
122
- | | | JPL | | |
123
- | | | | | |
124
- | | +-------+ | |
125
- | | | |
126
- | +-------------------------------------------------------------------------------+ |
127
- | |
128
- \-----------------------------------------------------------------------------------/
85
+ @startuml
86
+
87
+ frame "Compile time" {
88
+ [Application] --> [Log4j API] : logs to
89
+
90
+ [Log4j API] #Cyan
91
+
92
+ [SLF4J] #Cyan
93
+
94
+ [Library 1] --> [SLF4J] : logs to
95
+ [Application] --> [Library 1] : uses
96
+ [Application] --> [Library 2] : uses
97
+ [Application] --> [Library 3] : uses
98
+ }
99
+
100
+ frame Runtime {
101
+
102
+ [Log4j Core] <.. [Log4j API] : is implemented by
103
+ [Log4j Core] <.. (log4j2.xml) : is provided to
104
+ [Log4j Core] #LightGreen
105
+
106
+ [JPL-to-Log4j] ..> [Log4j Core] : forwards to
107
+ [JPL-to-Log4j] #Yellow
108
+
109
+ [SLF4J-to-Log4j] ..> [Log4j Core] : forwards to
110
+ [SLF4J-to-Log4j] #Yellow
111
+
112
+ [JUL-to-Log4j] ..> [Log4j Core] : forwards to
113
+ [JUL-to-Log4j] #Yellow
114
+
115
+ frame JRE {
116
+ [JPL] #Cyan
117
+ [JUL] #Cyan
118
+ }
119
+
120
+ }
121
+
122
+ [Library 2] --> [JUL] : logs to
123
+ [Library 3] --> [JPL] : logs to
124
+
125
+ [JPL] ..> [JPL-to-Log4j] : is implemented by
126
+ [JUL] ..> [JUL-to-Log4j] : is implemented by
127
+ [SLF4J] ..> [SLF4J-to-Log4j] : is implemented by
128
+
129
+ legend top right
130
+ | <#LightGreen> | Logging implementation |
131
+ | <#Yellow> | Logging bridge |
132
+ | <#Cyan> | Logging API |
133
+ | <size:18><U+2192></size> | Compile-time usage |
134
+ | <size:18><U+21E2></size> | Runtime usage |
135
+ endlegend
136
+
137
+ @enduml
129
138
....
130
139
131
140
// end::visual[]
0 commit comments