ppkarwasz commented on a change in pull request #786:
URL: https://github.com/apache/logging-log4j2/pull/786#discussion_r820201779
##########
File path:
log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/FileAppenderBuilder.java
##########
@@ -125,21 +125,16 @@ public Appender parseAppender(final String name, final
String appenderPrefix, fi
private Appender createAppender(final String name, final
Log4j1Configuration configuration, final Layout layout,
final Filter filter, final String fileName, final String level,
boolean immediateFlush, final boolean append,
final boolean bufferedIo, final int bufferSize) {
- org.apache.logging.log4j.core.Layout<?> fileLayout = null;
+ org.apache.logging.log4j.core.Layout<?> fileLayout =
LayoutAdapter.adapt(layout);
if (bufferedIo) {
immediateFlush = false;
}
- if (layout instanceof LayoutWrapper) {
- fileLayout = ((LayoutWrapper) layout).getLayout();
- } else if (layout != null) {
- fileLayout = new LayoutAdapter(layout);
- }
final org.apache.logging.log4j.core.Filter fileFilter =
buildFilters(level, filter);
if (fileName == null) {
LOGGER.error("Unable to create FileAppender, no file name
provided");
return null;
}
- return new AppenderWrapper(FileAppender.newBuilder()
+ return AppenderWrapper.wrap(FileAppender.newBuilder()
Review comment:
This and similar changes actually modify the function's behavior: if the
argument of `AppenderWrapper.wrap` is `null`, then `null` is returned. However
this should be counteracted by #768 .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]