"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractWriterAppender.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).

AbstractWriterAppender.java  (apache-log4j-2.11.1-src):AbstractWriterAppender.java  (apache-log4j-2.11.2-src)
skipping to change at line 27 skipping to change at line 27
package org.apache.logging.log4j.core.appender; package org.apache.logging.log4j.core.appender;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.StringLayout; import org.apache.logging.log4j.core.StringLayout;
import org.apache.logging.log4j.core.config.Property;
/** /**
* Appends log events as strings to a writer. * Appends log events as strings to a writer.
* *
* @param <M> * @param <M>
* The kind of {@link WriterManager} under management * The kind of {@link WriterManager} under management
*/ */
public abstract class AbstractWriterAppender<M extends WriterManager> extends Ab stractAppender { public abstract class AbstractWriterAppender<M extends WriterManager> extends Ab stractAppender {
/** /**
skipping to change at line 56 skipping to change at line 57
private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
private final Lock readLock = readWriteLock.readLock(); private final Lock readLock = readWriteLock.readLock();
/** /**
* Instantiates. * Instantiates.
* *
* @param name * @param name
* The name of the Appender. * The name of the Appender.
* @param layout * @param layout
* The layout to format the message. * The layout to format the message.
* @param properties
* Optional properties.
* @param manager * @param manager
* The OutputStreamManager. * The OutputStreamManager.
*/ */
protected AbstractWriterAppender(final String name, final StringLayout layou t, final Filter filter, protected AbstractWriterAppender(final String name, final StringLayout layou t, final Filter filter,
final boolean ignoreExceptions, final boolean immediateFlush, final
Property[] properties, final M manager) {
super(name, filter, layout, ignoreExceptions, properties);
this.manager = manager;
this.immediateFlush = immediateFlush;
}
/**
* Instantiates.
*
* @param name
* The name of the Appender.
* @param layout
* The layout to format the message.
* @param manager
* The OutputStreamManager.
* @deprecated Use {@link #AbstractWriterAppender(String, StringLayout, Filt
er, boolean, boolean, Property[], WriterManager)}.
*/
@Deprecated
protected AbstractWriterAppender(final String name, final StringLayout layou
t, final Filter filter,
final boolean ignoreExceptions, final boolean immediateFlush, final M manager) { final boolean ignoreExceptions, final boolean immediateFlush, final M manager) {
super(name, filter, layout, ignoreExceptions); super(name, filter, layout, ignoreExceptions, Property.EMPTY_ARRAY);
this.manager = manager; this.manager = manager;
this.immediateFlush = immediateFlush; this.immediateFlush = immediateFlush;
} }
/** /**
* Actual writing occurs here. * Actual writing occurs here.
* <p> * <p>
* Most subclasses will need to override this method. * Most subclasses will need to override this method.
* </p> * </p>
* *
skipping to change at line 87 skipping to change at line 109
readLock.lock(); readLock.lock();
try { try {
final String str = getStringLayout().toSerializable(event); final String str = getStringLayout().toSerializable(event);
if (str.length() > 0) { if (str.length() > 0) {
manager.write(str); manager.write(str);
if (this.immediateFlush || event.isEndOfBatch()) { if (this.immediateFlush || event.isEndOfBatch()) {
manager.flush(); manager.flush();
} }
} }
} catch (final AppenderLoggingException ex) { } catch (final AppenderLoggingException ex) {
error("Unable to write " + manager.getName() + " for appender " + ge tName() + ": " + ex); error("Unable to write " + manager.getName() + " for appender " + ge tName(), event, ex);
throw ex; throw ex;
} finally { } finally {
readLock.unlock(); readLock.unlock();
} }
} }
/** /**
* Gets the manager. * Gets the manager.
* *
* @return the manager. * @return the manager.
 End of changes. 5 change blocks. 
2 lines changed or deleted 27 lines changed or added

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