"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/site/xdoc/manual/extending.xml" 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).

extending.xml  (apache-log4j-2.11.1-src):extending.xml  (apache-log4j-2.11.2-src)
skipping to change at line 321 skipping to change at line 321
Appenders must also declare a PluginFactory method that will creat e the appender. The example Appenders must also declare a PluginFactory method that will creat e the appender. The example
below shows an Appender named "Stub" that can be used as an initia l template. below shows an Appender named "Stub" that can be used as an initia l template.
</p> </p>
<p> <p>
Most Appenders use Managers. A manager actually "owns" the resourc es, such as an OutputStream or Most Appenders use Managers. A manager actually "owns" the resourc es, such as an OutputStream or
socket. When a reconfiguration occurs a new Appender will be creat ed. However, if nothing significant socket. When a reconfiguration occurs a new Appender will be creat ed. However, if nothing significant
in the previous Manager has changed, the new Appender will simply reference it instead of creating a in the previous Manager has changed, the new Appender will simply reference it instead of creating a
new one. This insures that events are not lost while a reconfigura tion is taking place without new one. This insures that events are not lost while a reconfigura tion is taking place without
requiring that logging pause while the reconfiguration takes place . requiring that logging pause while the reconfiguration takes place .
</p> </p>
<pre class="prettyprint linenums"> <pre class="prettyprint linenums"><![CDATA[
@Plugin(name = "Stub", category = "Core", elementType = "appender", printObject = true) @Plugin(name = "Stub", category = "Core", elementType = "appender", printObject = true)
public final class StubAppender extends OutputStreamAppender { public final class StubAppender extends AbstractOutputStreamAppender<StubManager > {
private StubAppender(String name, Layout layout, Filter filter, StubManager private StubAppender(String name,
manager, Layout<? extends Serializable> layout,
boolean ignoreExceptions) { Filter filter,
boolean ignoreExceptions,
StubManager manager) {
super(name, layout, filter, ignoreExceptions, true, manager);
} }
@PluginFactory @PluginFactory
public static StubAppender createAppender(@PluginAttribute("name") String na me, public static StubAppender createAppender(@PluginAttribute("name") String na me,
@PluginAttribute("ignoreExceptions ") boolean ignoreExceptions, @PluginAttribute("ignoreExceptions ") boolean ignoreExceptions,
@PluginElement("Layout") Layout la yout, @PluginElement("Layout") Layout la yout,
@PluginElement("Filters") Filter f ilter) { @PluginElement("Filters") Filter f ilter) {
if (name == null) { if (name == null) {
LOGGER.error("No name provided for StubAppender"); LOGGER.error("No name provided for StubAppender");
return null; return null;
} }
StubManager manager = StubManager.getStubManager(name); StubManager manager = StubManager.getStubManager(name);
if (manager == null) { if (manager == null) {
return null; return null;
} }
if (layout == null) { if (layout == null) {
layout = PatternLayout.createDefaultLayout(); layout = PatternLayout.createDefaultLayout();
} }
return new StubAppender(name, layout, filter, manager, ignoreExceptions) ; return new StubAppender(name, layout, filter, ignoreExceptions, manager) ;
} }
}</pre> }]]></pre>
</subsection> </subsection>
<subsection name="Layouts"> <subsection name="Layouts">
<p> <p>
Layouts perform the formatting of events into the printable text t hat is written by Appenders to Layouts perform the formatting of events into the printable text t hat is written by Appenders to
some destination. All Layouts must implement the Layout interface. Layouts that format the some destination. All Layouts must implement the Layout interface. Layouts that format the
event into a String should extend AbstractStringLayout, which will take care of converting the event into a String should extend AbstractStringLayout, which will take care of converting the
String into the required byte array. String into the required byte array.
</p> </p>
<p> <p>
Every Layout must declare itself as a plugin using the Plugin anno tation. The type must be "Core", Every Layout must declare itself as a plugin using the Plugin anno tation. The type must be "Core",
 End of changes. 5 change blocks. 
7 lines changed or deleted 10 lines changed or added

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