本文整理了Java中org.apache.log4j.Layout.ignoresThrowable()
方法的一些代码示例,展示了Layout.ignoresThrowable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.ignoresThrowable()
方法的具体详情如下:
包路径:org.apache.log4j.Layout
类名称:Layout
方法名:ignoresThrowable
[英]If the layout handles the throwable object contained within LoggingEvent, then the layout should return false
. Otherwise, if the layout ignores throwable object, then the layout should return true
.
The SimpleLayout, TTCCLayout, PatternLayout all return true
. The org.apache.log4j.xml.XMLLayout returns false
.
[中]如果布局处理LoggingEvent中包含的可丢弃对象,则布局应返回false
。否则,如果布局忽略可丢弃对象,则布局应返回true
。
SimpleLayout、TTCCLayout和PatternLayout都返回true
。组织。阿帕奇。log4j。xml。XMLLayout返回false
。
代码示例来源:origin: cloudfoundry/uaa
@Override
public boolean ignoresThrowable() {
return messageLayout != null && messageLayout.ignoresThrowable();
}
代码示例来源:origin: log4j/log4j
public void append(LoggingEvent event) {
StringBuffer sbuf = new StringBuffer();
sbuf.append(layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
sbuf.append(s[i]);
}
}
}
// Normalize the log message level into the supported categories
int nt_category = event.getLevel().toInt();
// Anything above FATAL or below DEBUG is labeled as INFO.
//if (nt_category > FATAL || nt_category < DEBUG) {
// nt_category = INFO;
//}
reportEvent(_handle, sbuf.toString(), nt_category);
}
代码示例来源:origin: log4j/log4j
/** Handles a log event. For this appender, that means writing the
message to each connected client. */
protected void append(LoggingEvent event) {
if(sh != null) {
sh.send(layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
StringBuffer buf = new StringBuffer();
for(int i = 0; i < s.length; i++) {
buf.append(s[i]);
buf.append("\r\n");
}
sh.send(buf.toString());
}
}
}
}
代码示例来源:origin: log4j/log4j
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
代码示例来源:origin: log4j/log4j
if (layout == null || layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
代码示例来源:origin: cloudfoundry/uaa
@Test
public void ignores_throwable_only_if_message_layout_ignores_throwable() throws Exception {
LineAwareLayout lineAwareLayout = new LineAwareLayout();
Layout lineLayout = mock(Layout.class);
lineAwareLayout.setLineLayout(lineLayout);
when(lineLayout.ignoresThrowable()).thenReturn(false);
assertFalse(lineAwareLayout.ignoresThrowable());
when(lineLayout.ignoresThrowable()).thenReturn(true);
assertFalse(lineAwareLayout.ignoresThrowable());
Layout messageLayout = mock(Layout.class);
lineAwareLayout.setMessageLayout(messageLayout);
when(messageLayout.ignoresThrowable()).thenReturn(false);
assertFalse(lineAwareLayout.ignoresThrowable());
when(messageLayout.ignoresThrowable()).thenReturn(true);
assertTrue(lineAwareLayout.ignoresThrowable());
}
}
代码示例来源:origin: cloudfoundry/uaa
if (layout == null || layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
代码示例来源:origin: log4j/log4j
/**
Actual writing occurs here.
<p>Most subclasses of <code>WriterAppender</code> will need to
override this method.
@since 0.9.0 */
protected
void subAppend(LoggingEvent event) {
this.qw.write(this.layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
this.qw.write(s[i]);
this.qw.write(Layout.LINE_SEP);
}
}
}
if(shouldFlush(event)) {
this.qw.flush();
}
}
代码示例来源:origin: apache/log4j
public void append(LoggingEvent event) {
StringBuffer sbuf = new StringBuffer();
sbuf.append(layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
sbuf.append(s[i]);
}
}
}
// Normalize the log message level into the supported categories
int nt_category = event.getLevel().toInt();
// Anything above FATAL or below DEBUG is labeled as INFO.
//if (nt_category > FATAL || nt_category < DEBUG) {
// nt_category = INFO;
//}
reportEvent(_handle, sbuf.toString(), nt_category);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void append(LoggingEvent event) {
StringBuffer sbuf = new StringBuffer();
sbuf.append(layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
sbuf.append(s[i]);
}
}
}
// Normalize the log message level into the supported categories
int nt_category = event.getLevel().toInt();
// Anything above FATAL or below DEBUG is labeled as INFO.
//if (nt_category > FATAL || nt_category < DEBUG) {
// nt_category = INFO;
//}
reportEvent(_handle, sbuf.toString(), nt_category);
}
代码示例来源:origin: apache/log4j
/** Handles a log event. For this appender, that means writing the
message to each connected client. */
protected void append(LoggingEvent event) {
if(sh != null) {
sh.send(layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
StringBuffer buf = new StringBuffer();
for(int i = 0; i < s.length; i++) {
buf.append(s[i]);
buf.append(EOL);
}
sh.send(buf.toString());
}
}
}
}
代码示例来源:origin: apache/log4j
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
代码示例来源:origin: camunda/camunda-bpm-platform
/** Handles a log event. For this appender, that means writing the
message to each connected client. */
protected void append(LoggingEvent event) {
sh.send(this.layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
sh.send(s[i]);
sh.send(Layout.LINE_SEP);
}
}
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public
void append(LoggingEvent event) {
if(!isAsSevereAsThreshold(event.getLevel()))
return;
// We must not attempt to append if sqw is null.
if(sqw == null) {
errorHandler.error("No syslog host is set for SyslogAppedender named \""+
this.name+"\".");
return;
}
String buffer = (facilityPrinting? facilityStr : "") +
layout.format(event);
sqw.setLevel(event.getLevel().getSyslogEquivalent());
sqw.write(buffer);
if (layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
if(len > 0) {
sqw.write(s[0]);
for(int i = 1; i < len; i++) {
sqw.write(TAB+s[i].substring(1));
}
}
}
}
}
代码示例来源:origin: apache/log4j
if (layout == null || layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
代码示例来源:origin: camunda/camunda-bpm-platform
/**
Actual writing occurs here.
<p>Most subclasses of <code>WriterAppender</code> will need to
override this method.
@since 0.9.0 */
protected
void subAppend(LoggingEvent event) {
this.qw.write(this.layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
this.qw.write(s[i]);
this.qw.write(Layout.LINE_SEP);
}
}
}
if(this.immediateFlush) {
this.qw.flush();
}
}
代码示例来源:origin: apache/log4j
/**
Actual writing occurs here.
<p>Most subclasses of <code>WriterAppender</code> will need to
override this method.
@since 0.9.0 */
protected
void subAppend(LoggingEvent event) {
this.qw.write(this.layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
this.qw.write(s[i]);
this.qw.write(Layout.LINE_SEP);
}
}
}
if(shouldFlush(event)) {
this.qw.flush();
}
}
代码示例来源:origin: com.norconex.jef/norconex-jef
@Override
public boolean ignoresThrowable() {
return layout.ignoresThrowable();
}
}
代码示例来源:origin: org.ow2.sirocco.vmm/sirocco-vmm-agent-core
@Override
protected synchronized void append(final LoggingEvent event) {
if (start()) {
StringBuffer message = new StringBuffer(layout.format(event));
if (layout.ignoresThrowable() && event.getThrowableStrRep() != null) {
for (String exceptionStringRep : event.getThrowableStrRep()) {
message.append(exceptionStringRep);
}
}
Notification notification = new Notification(notificationType, oName, notificationSequence++, message.toString());
fireNotification(notification);
}
}
代码示例来源:origin: org.apache/log4j
/** Handles a log event. For this appender, that means writing the
message to each connected client. */
protected void append(LoggingEvent event) {
sh.send(this.layout.format(event));
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
int len = s.length;
for(int i = 0; i < len; i++) {
sh.send(s[i]);
sh.send(Layout.LINE_SEP);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!