本文整理了Java中org.apache.logging.log4j.core.Layout.getContentType()
方法的一些代码示例,展示了Layout.getContentType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.getContentType()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Layout
类名称:Layout
方法名:getContentType
[英]Returns the content type output by this layout. The base class returns "text/plain".
[中]返回此布局输出的内容类型。基类返回“text/plain”。
代码示例来源:origin: apache/hive
private HushableRandomAccessFileAppender(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, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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) {
super(name, layout, filter, ignoreExceptions, immediateFlush, 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;
}
代码示例来源:origin: org.infinispan/infinispan-commons-test
private CompressedFileAppender(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) {
super(name, layout, filter, ignoreExceptions, immediateFlush, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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) {
super(name, layout, filter, ignoreExceptions, immediateFlush, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
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) {
super(name, layout, filter, ignoreExceptions, immediateFlush, 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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
urlConnection.setReadTimeout(readTimeoutMillis);
if (layout.getContentType() != null) {
urlConnection.setRequestProperty("Content-Type", layout.getContentType());
代码示例来源:origin: org.apereo.cas/cas-server-core-logging
builder.append("state", appender.getState());
builder.append("layoutFormat", appender.getLayout().getContentFormat());
builder.append("layoutContentType", appender.getLayout().getContentType());
if (appender instanceof FileAppender) {
builder.append(FILE_PARAM, ((FileAppender) appender).getFileName());
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* Send the contents of the cyclic buffer as an e-mail message.
* @param layout The layout for formatting the events.
* @param appendEvent The event that triggered the send.
*/
public void sendEvents(final Layout<?> layout, final LogEvent appendEvent) {
if (message == null) {
connect(appendEvent);
}
try {
final LogEvent[] priorEvents = buffer.removeAll();
// LOG4J-310: log appendEvent even if priorEvents is empty
final byte[] rawBytes = formatContentToBytes(priorEvents, appendEvent, layout);
final String contentType = layout.getContentType();
final String encoding = getEncoding(rawBytes, contentType);
final byte[] encodedBytes = encodeContentToBytes(rawBytes, encoding);
final InternetHeaders headers = getHeaders(contentType, encoding);
final MimeMultipart mp = getMimeMultipart(encodedBytes, headers);
sendMultipartMessage(message, mp);
} catch (final MessagingException | IOException | RuntimeException e) {
logError("Caught exception while sending e-mail notification.", e);
throw new LoggingException("Error occurred while sending email", e);
}
}
内容来源于网络,如有侵权,请联系作者删除!