"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

SocketAppender.java  (apache-log4j-2.11.1-src):SocketAppender.java  (apache-log4j-2.11.2-src)
skipping to change at line 31 skipping to change at line 31
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.core.AbstractLifeCycle; import org.apache.logging.log4j.core.AbstractLifeCycle;
import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Core; import org.apache.logging.log4j.core.Core;
import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.Property;
import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAliases; import org.apache.logging.log4j.core.config.plugins.PluginAliases;
import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute; import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory; import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory;
import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginElement;
import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.config.plugins.validation.constraints.Valid Host; import org.apache.logging.log4j.core.config.plugins.validation.constraints.Valid Host;
import org.apache.logging.log4j.core.config.plugins.validation.constraints.Valid Port; import org.apache.logging.log4j.core.config.plugins.validation.constraints.Valid Port;
import org.apache.logging.log4j.core.net.AbstractSocketManager; import org.apache.logging.log4j.core.net.AbstractSocketManager;
import org.apache.logging.log4j.core.net.Advertiser; import org.apache.logging.log4j.core.net.Advertiser;
skipping to change at line 224 skipping to change at line 225
final Protocol protocol = getProtocol(); final Protocol protocol = getProtocol();
final Protocol actualProtocol = protocol != null ? protocol : Protoc ol.TCP; final Protocol actualProtocol = protocol != null ? protocol : Protoc ol.TCP;
if (actualProtocol == Protocol.UDP) { if (actualProtocol == Protocol.UDP) {
immediateFlush = true; immediateFlush = true;
} }
final AbstractSocketManager manager = SocketAppender.createSocketMan ager(name, actualProtocol, getHost(), getPort(), final AbstractSocketManager manager = SocketAppender.createSocketMan ager(name, actualProtocol, getHost(), getPort(),
getConnectTimeoutMillis(), getSslConfiguration(), getReconne ctDelayMillis(), getImmediateFail(), layout, getBufferSize(), getSocketOptions() ); getConnectTimeoutMillis(), getSslConfiguration(), getReconne ctDelayMillis(), getImmediateFail(), layout, getBufferSize(), getSocketOptions() );
return new SocketAppender(name, layout, getFilter(), manager, isIgno reExceptions(), return new SocketAppender(name, layout, getFilter(), manager, isIgno reExceptions(),
!bufferedIo || immediateFlush, getAdvertise() ? getConfigura !bufferedIo || immediateFlush, getAdvertise() ? getConfigura
tion().getAdvertiser() : null); tion().getAdvertiser() : null,
getPropertyArray());
} }
} }
@PluginBuilderFactory @PluginBuilderFactory
public static Builder newBuilder() { public static Builder newBuilder() {
return new Builder(); return new Builder();
} }
private final Object advertisement; private final Object advertisement;
private final Advertiser advertiser; private final Advertiser advertiser;
protected SocketAppender(final String name, final Layout<? extends Serializa ble> layout, final Filter filter, protected SocketAppender(final String name, final Layout<? extends Serializa ble> layout, final Filter filter,
final AbstractSocketManager manager, final boolean ignoreExceptions, final boolean immediateFlush, final AbstractSocketManager manager, final boolean ignoreExceptions, final boolean immediateFlush,
final Advertiser advertiser) { final Advertiser advertiser, final Property[] properties) {
super(name, layout, filter, ignoreExceptions, immediateFlush, manager); super(name, layout, filter, ignoreExceptions, immediateFlush, properties
, manager);
if (advertiser != null) { if (advertiser != null) {
final Map<String, String> configuration = new HashMap<>(layout.getCo ntentFormat()); final Map<String, String> configuration = new HashMap<>(layout.getCo ntentFormat());
configuration.putAll(manager.getContentFormat()); configuration.putAll(manager.getContentFormat());
configuration.put("contentType", layout.getContentType()); configuration.put("contentType", layout.getContentType());
configuration.put("name", name); configuration.put("name", name);
this.advertisement = advertiser.advertise(configuration); this.advertisement = advertiser.advertise(configuration);
} else { } else {
this.advertisement = null; this.advertisement = null;
} }
this.advertiser = advertiser; this.advertiser = advertiser;
} }
/**
* @deprecated {@link #SocketAppender(String, Layout, Filter, AbstractSocket
Manager, boolean, boolean, Advertiser, Property[])}.
*/
@Deprecated
protected SocketAppender(final String name, final Layout<? extends Serializa
ble> layout, final Filter filter,
final AbstractSocketManager manager, final boolean ignoreExceptions,
final boolean immediateFlush,
final Advertiser advertiser) {
this(name, layout, filter, manager, ignoreExceptions, immediateFlush, ad
vertiser, Property.EMPTY_ARRAY);
}
@Override @Override
public boolean stop(final long timeout, final TimeUnit timeUnit) { public boolean stop(final long timeout, final TimeUnit timeUnit) {
setStopping(); setStopping();
super.stop(timeout, timeUnit, false); super.stop(timeout, timeUnit, false);
if (this.advertiser != null) { if (this.advertiser != null) {
this.advertiser.unadvertise(this.advertisement); this.advertiser.unadvertise(this.advertisement);
} }
setStopped(); setStopped();
return true; return true;
} }
skipping to change at line 320 skipping to change at line 332
final boolean immediateFlush, final boolean immediateFlush,
final boolean ignoreExceptions, final boolean ignoreExceptions,
final Layout<? extends Serializable> layout, final Layout<? extends Serializable> layout,
final Filter filter, final Filter filter,
final boolean advertise, final boolean advertise,
final Configuration configuration) { final Configuration configuration) {
// @formatter:on // @formatter:on
// @formatter:off // @formatter:off
return newBuilder() return newBuilder()
.withAdvertise(advertise) .withAdvertise(advertise)
.setConfiguration(configuration) .setConfiguration(configuration)
.withConnectTimeoutMillis(connectTimeoutMillis) .withConnectTimeoutMillis(connectTimeoutMillis).setFilter(filter)
.withFilter(filter) .withHost(host).setIgnoreExceptions(ignoreExceptions)
.withHost(host) .withImmediateFail(immediateFail).setLayout(layout).setName(name)
.withIgnoreExceptions(ignoreExceptions)
.withImmediateFail(immediateFail)
.withLayout(layout)
.withName(name)
.withPort(port) .withPort(port)
.withProtocol(protocol) .withProtocol(protocol)
.withReconnectDelayMillis(reconnectDelayMillis) .withReconnectDelayMillis(reconnectDelayMillis)
.withSslConfiguration(sslConfig) .withSslConfiguration(sslConfig)
.build(); .build();
// @formatter:on // @formatter:on
} }
/** /**
* Creates a socket appender. * Creates a socket appender.
 End of changes. 5 change blocks. 
13 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)