"Fossies" - the Fresh Open Source Software Archive  

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

CountingNoOpAppender.java  (apache-log4j-2.11.1-src):CountingNoOpAppender.java  (apache-log4j-2.11.2-src)
skipping to change at line 26 skipping to change at line 26
*/ */
package org.apache.logging.log4j.core.appender; package org.apache.logging.log4j.core.appender;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
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.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.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.PluginAttribute; import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.config.plugins.PluginFactory;
/** /**
* No-Operation Appender that counts events. * No-Operation Appender that counts events.
*/ */
@Plugin(name = "CountingNoOp", category = Core.CATEGORY_NAME, elementType = Appe nder.ELEMENT_TYPE, printObject = true) @Plugin(name = "CountingNoOp", category = Core.CATEGORY_NAME, elementType = Appe nder.ELEMENT_TYPE, printObject = true)
public class CountingNoOpAppender extends AbstractAppender { public class CountingNoOpAppender extends AbstractAppender {
private final AtomicLong total = new AtomicLong(); private final AtomicLong total = new AtomicLong();
public CountingNoOpAppender(final String name, final Layout<?> layout) { public CountingNoOpAppender(final String name, final Layout<?> layout) {
super(name, null, layout); super(name, null, layout, true, Property.EMPTY_ARRAY);
}
private CountingNoOpAppender(final String name, final Layout<?> layout, fina
l Property[] properties) {
super(name, null, layout, true, properties);
} }
public long getCount() { public long getCount() {
return total.get(); return total.get();
} }
@Override @Override
public void append(final LogEvent event) { public void append(final LogEvent event) {
total.incrementAndGet(); total.incrementAndGet();
} }
/** /**
* Creates a CountingNoOp Appender. * Creates a CountingNoOp Appender.
*/ */
@PluginFactory @PluginFactory
public static CountingNoOpAppender createAppender(@PluginAttribute("name") f inal String name) { public static CountingNoOpAppender createAppender(@PluginAttribute("name") f inal String name) {
return new CountingNoOpAppender(Objects.requireNonNull(name), null); return new CountingNoOpAppender(Objects.requireNonNull(name), null, Prop erty.EMPTY_ARRAY);
} }
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 8 lines changed or added

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