3232import org .apache .logging .log4j .core .async .AsyncLoggerContextSelector ;
3333import org .apache .logging .log4j .core .config .plugins .PluginConfiguration ;
3434import org .apache .logging .log4j .core .filter .AbstractFilterable ;
35- import org .apache .logging .log4j .core .impl .DefaultLogEventFactory ;
3635import org .apache .logging .log4j .core .impl .Log4jLogEvent ;
3736import org .apache .logging .log4j .core .impl .LogEventFactory ;
37+ import org .apache .logging .log4j .core .impl .ReusableLogEventFactory ;
3838import org .apache .logging .log4j .core .lookup .StrSubstitutor ;
3939import org .apache .logging .log4j .message .Message ;
4040import org .apache .logging .log4j .plugins .Configurable ;
4444import org .apache .logging .log4j .plugins .PluginBuilderAttribute ;
4545import org .apache .logging .log4j .plugins .PluginElement ;
4646import org .apache .logging .log4j .plugins .PluginFactory ;
47+ import org .apache .logging .log4j .plugins .di .DI ;
4748import org .apache .logging .log4j .plugins .validation .constraints .Required ;
4849import org .apache .logging .log4j .util .PerformanceSensitive ;
4950import org .apache .logging .log4j .util .StackLocatorUtil ;
@@ -218,7 +219,7 @@ public B asBuilder() {
218219 * Default constructor.
219220 */
220221 public LoggerConfig () {
221- this .logEventFactory = DefaultLogEventFactory . newInstance ( );
222+ this .logEventFactory = DI . createInitializedFactory (). getInstance ( ReusableLogEventFactory . class );
222223 this .level = Level .ERROR ;
223224 this .name = Strings .EMPTY ;
224225 this .properties = null ;
@@ -235,7 +236,7 @@ public LoggerConfig() {
235236 * @param additive true if the Logger is additive, false otherwise.
236237 */
237238 public LoggerConfig (final String name , final Level level , final boolean additive ) {
238- this .logEventFactory = DefaultLogEventFactory . newInstance ( );
239+ this .logEventFactory = DI . createInitializedFactory (). getInstance ( ReusableLogEventFactory . class );
239240 this .name = name ;
240241 this .level = level ;
241242 this .additive = additive ;
@@ -256,7 +257,9 @@ protected LoggerConfig(
256257 final boolean includeLocation ,
257258 final LogEventFactory logEventFactory ) {
258259 super (filter , null );
259- this .logEventFactory = logEventFactory != null ? logEventFactory : DefaultLogEventFactory .newInstance ();
260+ this .logEventFactory = logEventFactory != null
261+ ? logEventFactory
262+ : DI .createInitializedFactory ().getInstance (ReusableLogEventFactory .class );
260263 this .name = name ;
261264 this .appenderRefs = appenders ;
262265 this .level = level ;
0 commit comments