32
32
import org .apache .logging .log4j .core .async .AsyncLoggerContextSelector ;
33
33
import org .apache .logging .log4j .core .config .plugins .PluginConfiguration ;
34
34
import org .apache .logging .log4j .core .filter .AbstractFilterable ;
35
- import org .apache .logging .log4j .core .impl .DefaultLogEventFactory ;
36
35
import org .apache .logging .log4j .core .impl .Log4jLogEvent ;
37
36
import org .apache .logging .log4j .core .impl .LogEventFactory ;
37
+ import org .apache .logging .log4j .core .impl .ReusableLogEventFactory ;
38
38
import org .apache .logging .log4j .core .lookup .StrSubstitutor ;
39
39
import org .apache .logging .log4j .message .Message ;
40
40
import org .apache .logging .log4j .plugins .Configurable ;
44
44
import org .apache .logging .log4j .plugins .PluginBuilderAttribute ;
45
45
import org .apache .logging .log4j .plugins .PluginElement ;
46
46
import org .apache .logging .log4j .plugins .PluginFactory ;
47
+ import org .apache .logging .log4j .plugins .di .DI ;
47
48
import org .apache .logging .log4j .plugins .validation .constraints .Required ;
48
49
import org .apache .logging .log4j .util .PerformanceSensitive ;
49
50
import org .apache .logging .log4j .util .StackLocatorUtil ;
@@ -218,7 +219,7 @@ public B asBuilder() {
218
219
* Default constructor.
219
220
*/
220
221
public LoggerConfig () {
221
- this .logEventFactory = DefaultLogEventFactory . newInstance ( );
222
+ this .logEventFactory = DI . createInitializedFactory (). getInstance ( ReusableLogEventFactory . class );
222
223
this .level = Level .ERROR ;
223
224
this .name = Strings .EMPTY ;
224
225
this .properties = null ;
@@ -235,7 +236,7 @@ public LoggerConfig() {
235
236
* @param additive true if the Logger is additive, false otherwise.
236
237
*/
237
238
public LoggerConfig (final String name , final Level level , final boolean additive ) {
238
- this .logEventFactory = DefaultLogEventFactory . newInstance ( );
239
+ this .logEventFactory = DI . createInitializedFactory (). getInstance ( ReusableLogEventFactory . class );
239
240
this .name = name ;
240
241
this .level = level ;
241
242
this .additive = additive ;
@@ -256,7 +257,9 @@ protected LoggerConfig(
256
257
final boolean includeLocation ,
257
258
final LogEventFactory logEventFactory ) {
258
259
super (filter , null );
259
- this .logEventFactory = logEventFactory != null ? logEventFactory : DefaultLogEventFactory .newInstance ();
260
+ this .logEventFactory = logEventFactory != null
261
+ ? logEventFactory
262
+ : DI .createInitializedFactory ().getInstance (ReusableLogEventFactory .class );
260
263
this .name = name ;
261
264
this .appenderRefs = appenders ;
262
265
this .level = level ;
0 commit comments