Java Code Examples for org.apache.logging.log4j.core.Layout#getContentFormat()

The following examples show how to use org.apache.logging.log4j.core.Layout#getContentFormat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFileAppender.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private AbstractFileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
        final M manager, final String filename, final boolean ignoreExceptions,
        final boolean immediateFlush, final Advertiser advertiser, Property[] properties) {

    super(name, layout, filter, ignoreExceptions, immediateFlush, properties, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
        configuration.putAll(manager.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        advertisement = advertiser.advertise(configuration);
    } else {
        advertisement = null;
    }
    this.fileName = filename;
    this.advertiser = advertiser;
}
 
Example 2
Source File: RollingRandomAccessFileAppender.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private RollingRandomAccessFileAppender(final String name, final Layout<? extends Serializable> layout,
        final Filter filter, final RollingRandomAccessFileManager manager, final String fileName,
        final String filePattern, final boolean ignoreExceptions,
        final boolean immediateFlush, final int bufferSize, final Advertiser advertiser) {
    super(name, layout, filter, ignoreExceptions, immediateFlush, null, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        advertisement = advertiser.advertise(configuration);
    } else {
        advertisement = null;
    }
    this.fileName = fileName;
    this.filePattern = filePattern;
    this.advertiser = advertiser;
}
 
Example 3
Source File: RandomAccessFileAppender.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private RandomAccessFileAppender(final String name, final Layout<? extends Serializable> layout,
        final Filter filter, final RandomAccessFileManager manager, final String filename,
        final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser) {

    super(name, layout, filter, ignoreExceptions, immediateFlush, null, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(
                layout.getContentFormat());
        configuration.putAll(manager.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        advertisement = advertiser.advertise(configuration);
    }
    this.fileName = filename;
    this.advertiser = advertiser;
}
 
Example 4
Source File: FileAppender.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private FileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
        final FileManager manager, final String filename, final boolean ignoreExceptions,
        final boolean immediateFlush, final Advertiser advertiser, Property[] properties) {

    super(name, layout, filter, ignoreExceptions, immediateFlush, properties, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
        configuration.putAll(manager.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        advertisement = advertiser.advertise(configuration);
    } else {
        advertisement = null;
    }
    this.fileName = filename;
    this.advertiser = advertiser;
}
 
Example 5
Source File: RollingFileAppender.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
private RollingFileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
        final RollingFileManager manager, final String fileName, final String filePattern,
        final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser) {
    super(name, layout, filter, ignoreExceptions, immediateFlush, null, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        advertisement = advertiser.advertise(configuration);
    }
    this.fileName = fileName;
    this.filePattern = filePattern;
    this.advertiser = advertiser;
}
 
Example 6
Source File: MemoryMappedFileAppender.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
private MemoryMappedFileAppender(final String name, final Layout<? extends Serializable> layout,
        final Filter filter, final MemoryMappedFileManager manager, final String filename,
        final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser, Property[] properties) {
    super(name, layout, filter, ignoreExceptions, immediateFlush, properties, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
        configuration.putAll(manager.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        advertisement = advertiser.advertise(configuration);
    }
    this.fileName = filename;
    this.advertiser = advertiser;
}
 
Example 7
Source File: SocketAppender.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
protected SocketAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
        final AbstractSocketManager manager, final boolean ignoreExceptions, final boolean immediateFlush,
        final Advertiser advertiser) {
    super(name, layout, filter, ignoreExceptions, immediateFlush, null, manager);
    if (advertiser != null) {
        final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
        configuration.putAll(manager.getContentFormat());
        configuration.put("contentType", layout.getContentType());
        configuration.put("name", name);
        this.advertisement = advertiser.advertise(configuration);
    } else {
        this.advertisement = null;
    }
    this.advertiser = advertiser;
}