void appendThrowableAsHTML(String s[], StringBuilder sbuf)
{
if( s != null )
{
int len = s.length;
if( len == 0 )
{
return;
}
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for( int i = 1; i < len; i++ )
{
sbuf.append("<br> ");
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
java类org.apache.log4j.helpers.Transform的实例源码
HTMLLayout3.java 文件源码
项目:Equella
阅读 26
收藏 0
点赞 0
评论 0
HTMLLayout3.java 文件源码
项目:Equella
阅读 24
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML(String s[], StringBuilder sbuf)
{
if( s != null )
{
int len = s.length;
if( len == 0 )
{
return;
}
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for( int i = 1; i < len; i++ )
{
sbuf.append("<br> ");
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
HTMLLayout2.java 文件源码
项目:Equella
阅读 30
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML(String s[], StringBuilder sbuf)
{
if( s != null )
{
int len = s.length;
if( len == 0 )
{
return;
}
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for( int i = 1; i < len; i++ )
{
sbuf.append("<br> ");
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
HTMLLayout3.java 文件源码
项目:Equella
阅读 21
收藏 0
点赞 0
评论 0
@Override
public String format(LoggingEvent event)
{
StringBuilder sbuf = new StringBuilder();
sbuf.append(Layout.LINE_SEP);
sbuf.append("<tr><td>");
sbuf.append(dateFormat.format(new Date(event.timeStamp)));
sbuf.append("</td><td>");
appendContextText(event, sbuf);
sbuf.append("</td><td>");
appendLevelText(event, sbuf);
sbuf.append("</td><td>");
appendLoggerName(event, sbuf);
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td></tr>");
String s[] = event.getThrowableStrRep();
if( s != null )
{
sbuf.append(Layout.LINE_SEP);
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"5\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>");
}
return sbuf.toString();
}
HTMLLayout3.java 文件源码
项目:Equella
阅读 24
收藏 0
点赞 0
评论 0
protected void appendLoggerName(LoggingEvent event, StringBuilder sbuf)
{
String n = event.getLoggerName();
int end = n.lastIndexOf('.', n.length() - 2);
if( end >= 0 )
{
n = n.substring(end + 1);
}
sbuf.append(Transform.escapeTags(n));
}
HTMLLayout3.java 文件源码
项目:Equella
阅读 23
收藏 0
点赞 0
评论 0
protected void appendContextText(LoggingEvent event, StringBuilder sbuf)
{
Object context = event.getMDC("SessionID");
if( context != null )
{
sbuf.append(Transform.escapeTags(context.toString()));
}
}
HTMLLayout3.java 文件源码
项目:Equella
阅读 27
收藏 0
点赞 0
评论 0
@Override
public String format(LoggingEvent event)
{
StringBuilder sbuf = new StringBuilder();
sbuf.append(Layout.LINE_SEP);
sbuf.append("<tr><td>");
sbuf.append(dateFormat.format(new Date(event.timeStamp)));
sbuf.append("</td><td>");
appendContextText(event, sbuf);
sbuf.append("</td><td>");
appendLevelText(event, sbuf);
sbuf.append("</td><td>");
appendLoggerName(event, sbuf);
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td></tr>");
String s[] = event.getThrowableStrRep();
if( s != null )
{
sbuf.append(Layout.LINE_SEP);
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"5\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>");
}
return sbuf.toString();
}
HTMLLayout3.java 文件源码
项目:Equella
阅读 26
收藏 0
点赞 0
评论 0
protected void appendLoggerName(LoggingEvent event, StringBuilder sbuf)
{
String n = event.getLoggerName();
int end = n.lastIndexOf('.', n.length() - 2);
if( end >= 0 )
{
n = n.substring(end + 1);
}
sbuf.append(Transform.escapeTags(n));
}
HTMLLayout3.java 文件源码
项目:Equella
阅读 23
收藏 0
点赞 0
评论 0
protected void appendContextText(LoggingEvent event, StringBuilder sbuf)
{
Object context = event.getMDC("SessionID");
if( context != null )
{
sbuf.append(Transform.escapeTags(context.toString()));
}
}
HTMLLayout.java 文件源码
项目:cacheonix-core
阅读 27
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML(String[] s, StringBuffer sbuf) {
if(s != null) {
int len = s.length;
if(len == 0)
return;
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for(int i = 1; i < len; i++) {
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
FormatHTMLLayout.java 文件源码
项目:log4j-collector
阅读 26
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML(String[] s, StringBuffer sbuf) {
if (s != null) {
int len = s.length;
if (len == 0)
return;
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for (int i = 1; i < len; i++) {
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
HTMLLayout.java 文件源码
项目:daq-eclipse
阅读 32
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML(String[] s, StringBuffer sbuf) {
if(s != null) {
int len = s.length;
if(len == 0)
return;
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for(int i = 1; i < len; i++) {
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
JBoxHtmlLayout.java 文件源码
项目:JBox
阅读 23
收藏 0
点赞 0
评论 0
private void MyappendThrowableAsHTML(String[] s, StringBuffer sbuf) {
if(s != null) {
int len = s.length;
if(len == 0)
return;
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for(int i = 1; i < len; i++) {
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
HTMLLayout.java 文件源码
项目:nabs
阅读 22
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML(String[] s, StringBuffer sbuf) {
if(s != null) {
int len = s.length;
if(len == 0)
return;
sbuf.append(Transform.escapeTags(s[0]));
sbuf.append(Layout.LINE_SEP);
for(int i = 1; i < len; i++) {
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(s[i]));
sbuf.append(Layout.LINE_SEP);
}
}
}
PurgeUtilityHTMLLayout.java 文件源码
项目:pentaho-kettle
阅读 20
收藏 0
点赞 0
评论 0
void appendThrowableAsHTML( String[] s, StringBuffer sbuf ) {
if ( s != null ) {
int len = s.length;
if ( len == 0 ) {
return;
}
sbuf.append( Transform.escapeTags( s[0] ) );
sbuf.append( Layout.LINE_SEP );
for ( int i = 1; i < len; i++ ) {
sbuf.append( TRACE_PREFIX );
sbuf.append( Transform.escapeTags( s[i] ) );
sbuf.append( Layout.LINE_SEP );
}
}
}
HTMLLayout2.java 文件源码
项目:Equella
阅读 19
收藏 0
点赞 0
评论 0
@Override
public String format(LoggingEvent event)
{
if( sbuf.capacity() > 1024 )
{
sbuf = new StringBuilder(256);
}
else
{
sbuf.setLength(0);
}
sbuf.append(Layout.LINE_SEP);
sbuf.append("<tr>");
sbuf.append(Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(dateFormat.format(new Date(event.timeStamp)));
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
sbuf.append("<td>");
if( event.getLevel().equals(Level.DEBUG) )
{
sbuf.append("<font color=\"#339933\">");
sbuf.append(event.getLevel());
sbuf.append("</font>");
}
else if( event.getLevel().isGreaterOrEqual(Level.WARN) )
{
sbuf.append("<font color=\"#993300\"><strong>");
sbuf.append(event.getLevel());
sbuf.append("</strong></font>");
}
else
{
sbuf.append(event.getLevel());
}
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(event.getLoggerName()));
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
if( locationInfo )
{
LocationInfo locInfo = event.getLocationInformation();
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(locInfo.getFileName()));
sbuf.append(':');
sbuf.append(locInfo.getLineNumber());
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
}
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td>");
sbuf.append(Layout.LINE_SEP);
sbuf.append("</tr>");
sbuf.append(Layout.LINE_SEP);
if( event.getNDC() != null )
{
sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">");
sbuf.append("NDC: ");
sbuf.append(Transform.escapeTags(event.getNDC()));
sbuf.append("</td></tr>");
sbuf.append(Layout.LINE_SEP);
}
String s[] = event.getThrowableStrRep();
if( s != null )
{
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>");
sbuf.append(Layout.LINE_SEP);
}
return sbuf.toString();
}
HTMLLayout.java 文件源码
项目:cacheonix-core
阅读 22
收藏 0
点赞 0
评论 0
public
String format(LoggingEvent event) {
if(sbuf.capacity() > MAX_CAPACITY) {
sbuf = new StringBuffer(BUF_SIZE);
} else {
sbuf.setLength(0);
}
sbuf.append(Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(event.timeStamp - LoggingEvent.getStartTime());
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedThread = Transform.escapeTags(event.getThreadName());
sbuf.append("<td title=\"" + escapedThread + " thread\">");
sbuf.append(escapedThread);
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"Level\">");
if (event.getLevel().equals(Level.DEBUG)) {
sbuf.append("<font color=\"#339933\">");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</font>");
}
else if(event.getLevel().isGreaterOrEqual(Level.WARN)) {
sbuf.append("<font color=\"#993300\"><strong>");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</strong></font>");
} else {
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
}
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedLogger = Transform.escapeTags(event.getLoggerName());
sbuf.append("<td title=\"" + escapedLogger + " category\">");
sbuf.append(escapedLogger);
sbuf.append("</td>" + Layout.LINE_SEP);
if(locationInfo) {
LocationInfo locInfo = event.getLocationInformation();
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(locInfo.getFileName()));
sbuf.append(':');
sbuf.append(locInfo.getLineNumber());
sbuf.append("</td>" + Layout.LINE_SEP);
}
sbuf.append("<td title=\"Message\">");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("</tr>" + Layout.LINE_SEP);
if (event.getNDC() != null) {
sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">");
sbuf.append("NDC: " + Transform.escapeTags(event.getNDC()));
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
String[] s = event.getThrowableStrRep();
if(s != null) {
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
return sbuf.toString();
}
FormatHTMLLayout.java 文件源码
项目:log4j-collector
阅读 27
收藏 0
点赞 0
评论 0
public String format(LoggingEvent event) {
if (sbuf.capacity() > MAX_CAPACITY) {
sbuf = new StringBuffer(BUF_SIZE);
} else {
sbuf.setLength(0);
}
sbuf.append(Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP);
sbuf.append("<td >");
// sbuf.append(event.timeStamp - LoggingEvent.getStartTime());
sbuf.append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date()));
sbuf.append("</td>" + Layout.LINE_SEP);
Object app = event.getMDC("app");
sbuf.append("<td title=\"" + app + " thread\">");
if(app!=null){
sbuf.append(app.toString());
}
sbuf.append(" </td>" + Layout.LINE_SEP);
String escapedThread = Transform.escapeTags(event.getThreadName());
sbuf.append("<td title=\"" + escapedThread + " thread\">");
sbuf.append(escapedThread);
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"Level\">");
if (event.getLevel().equals(Level.DEBUG)) {
sbuf.append("<font color=\"#339933\">");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</font>");
} else if (event.getLevel().isGreaterOrEqual(Level.WARN)) {
sbuf.append("<font color=\"#993300\"><strong>");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</strong></font>");
} else {
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
}
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedLogger = Transform.escapeTags(event.getLoggerName());
sbuf.append("<td title=\"" + escapedLogger + " category\">");
sbuf.append(escapedLogger);
sbuf.append("</td>" + Layout.LINE_SEP);
if (locationInfo) {
LocationInfo locInfo = event.getLocationInformation();
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(locInfo.getFileName()));
sbuf.append(':');
sbuf.append(locInfo.getLineNumber());
sbuf.append("</td>" + Layout.LINE_SEP);
}
sbuf.append("<td title=\"Message\">");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("</tr>" + Layout.LINE_SEP);
if (event.getNDC() != null) {
sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">");
sbuf.append("NDC: " + Transform.escapeTags(event.getNDC()));
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
String[] s = event.getThrowableStrRep();
if (s != null) {
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
return sbuf.toString();
}
HTMLLayout.java 文件源码
项目:daq-eclipse
阅读 23
收藏 0
点赞 0
评论 0
public
String format(LoggingEvent event) {
if(sbuf.capacity() > MAX_CAPACITY) {
sbuf = new StringBuffer(BUF_SIZE);
} else {
sbuf.setLength(0);
}
sbuf.append(Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(event.timeStamp - LoggingEvent.getStartTime());
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedThread = Transform.escapeTags(event.getThreadName());
sbuf.append("<td title=\"" + escapedThread + " thread\">");
sbuf.append(escapedThread);
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"Level\">");
if (event.getLevel().equals(Level.DEBUG)) {
sbuf.append("<font color=\"#339933\">");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</font>");
}
else if(event.getLevel().isGreaterOrEqual(Level.WARN)) {
sbuf.append("<font color=\"#993300\"><strong>");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</strong></font>");
} else {
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
}
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedLogger = Transform.escapeTags(event.getLoggerName());
sbuf.append("<td title=\"" + escapedLogger + " category\">");
sbuf.append(escapedLogger);
sbuf.append("</td>" + Layout.LINE_SEP);
if(locationInfo) {
LocationInfo locInfo = event.getLocationInformation();
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(locInfo.getFileName()));
sbuf.append(':');
sbuf.append(locInfo.getLineNumber());
sbuf.append("</td>" + Layout.LINE_SEP);
}
sbuf.append("<td title=\"Message\">");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("</tr>" + Layout.LINE_SEP);
if (event.getNDC() != null) {
sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">");
sbuf.append("NDC: " + Transform.escapeTags(event.getNDC()));
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
String[] s = event.getThrowableStrRep();
if(s != null) {
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
return sbuf.toString();
}
JBoxHtmlLayout.java 文件源码
项目:JBox
阅读 23
收藏 0
点赞 0
评论 0
public String format(LoggingEvent event) {
if (sbuf.capacity() > MAX_CAPACITY) {
sbuf = new StringBuffer(BUF_SIZE);
} else {
sbuf.setLength(0);
}
sbuf.append(Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(event.timeStamp);
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
sbuf.append("<td>");
sbuf.append(formatter.format(calendar.getTime()));
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedThread = Transform.escapeTags(event.getThreadName());
sbuf.append("<td title=\"" + escapedThread + " thread\">");
sbuf.append(escapedThread);
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"Level\">");
if (event.getLevel().equals(Level.DEBUG)) {
sbuf.append("<font color=\"#339933\">");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</font>");
} else if (event.getLevel().isGreaterOrEqual(Level.WARN)) {
sbuf.append("<font color=\"#993300\"><strong>");
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
sbuf.append("</strong></font>");
} else {
sbuf.append(Transform.escapeTags(String.valueOf(event.getLevel())));
}
sbuf.append("</td>" + Layout.LINE_SEP);
String escapedLogger = Transform.escapeTags(event.getLoggerName());
sbuf.append("<td title=\"" + escapedLogger + " category\">");
sbuf.append(escapedLogger);
sbuf.append("</td>" + Layout.LINE_SEP);
if (locationInfo) {
LocationInfo locInfo = event.getLocationInformation();
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(locInfo.getFileName()));
sbuf.append(':');
sbuf.append(locInfo.getLineNumber());
sbuf.append("</td>" + Layout.LINE_SEP);
}
sbuf.append("<td title=\"Message\">");
//sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append(event.getRenderedMessage());
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("</tr>" + Layout.LINE_SEP);
if (event.getNDC() != null) {
sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">");
sbuf.append("NDC: " + Transform.escapeTags(event.getNDC()));
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
String[] s = event.getThrowableStrRep();
if (s != null) {
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">");
MyappendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
return sbuf.toString();
}
HTMLLayout.java 文件源码
项目:nabs
阅读 25
收藏 0
点赞 0
评论 0
public
String format(LoggingEvent event) {
if(sbuf.capacity() > MAX_CAPACITY) {
sbuf = new StringBuffer(BUF_SIZE);
} else {
sbuf.setLength(0);
}
sbuf.append(Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP);
sbuf.append("<td>");
sbuf.append(event.timeStamp - event.getStartTime());
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"" + event.getThreadName() + " thread\">");
sbuf.append(Transform.escapeTags(event.getThreadName()));
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"Level\">");
if (event.getLevel().equals(Level.DEBUG)) {
sbuf.append("<font color=\"#339933\">");
sbuf.append(event.getLevel());
sbuf.append("</font>");
}
else if(event.getLevel().isGreaterOrEqual(Level.WARN)) {
sbuf.append("<font color=\"#993300\"><strong>");
sbuf.append(event.getLevel());
sbuf.append("</strong></font>");
} else {
sbuf.append(event.getLevel());
}
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"" + event.getLoggerName() + " category\">");
sbuf.append(Transform.escapeTags(event.getLoggerName()));
sbuf.append("</td>" + Layout.LINE_SEP);
if(locationInfo) {
LocationInfo locInfo = event.getLocationInformation();
sbuf.append("<td>");
sbuf.append(Transform.escapeTags(locInfo.getFileName()));
sbuf.append(':');
sbuf.append(locInfo.getLineNumber());
sbuf.append("</td>" + Layout.LINE_SEP);
}
sbuf.append("<td title=\"Message\">");
sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("</tr>" + Layout.LINE_SEP);
if (event.getNDC() != null) {
sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">");
sbuf.append("NDC: " + Transform.escapeTags(event.getNDC()));
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
String[] s = event.getThrowableStrRep();
if(s != null) {
sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">");
appendThrowableAsHTML(s, sbuf);
sbuf.append("</td></tr>" + Layout.LINE_SEP);
}
return sbuf.toString();
}
PurgeUtilityHTMLLayout.java 文件源码
项目:pentaho-kettle
阅读 22
收藏 0
点赞 0
评论 0
public String format( LoggingEvent event ) {
Level logLevel = event.getLevel();
if ( sbuf.capacity() > MAX_CAPACITY ) {
sbuf = new StringBuffer( BUF_SIZE );
} else {
sbuf.setLength( 0 );
}
if ( showTimeColumn() ) {
DateFormat df = new SimpleDateFormat( "MM/dd/yyyy HH:mm:ss" );
Date date = new Date();
date.setTime( event.timeStamp );
String time = null;
try {
time = df.format( date );
} catch ( Exception ex ) {
LogLog.error( "Error occured while converting date.", ex );
}
sbuf.append( Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP );
sbuf.append( "<td>" );
sbuf.append( Transform.escapeTags( time ) );
sbuf.append( "</td>" + Layout.LINE_SEP );
}
sbuf.append( "<td title=\"Purge File/Folder\">" );
sbuf.append( Transform.escapeTags( MDC.get( PurgeUtilityLog.FILE_KEY ) ) );
sbuf.append( "</td>" + Layout.LINE_SEP );
if ( showLevelColumn() ) {
sbuf.append( "<td title=\"Level\">" );
if ( logLevel.equals( Level.DEBUG ) ) {
sbuf.append( "<font color=\"#339933\">" );
sbuf.append( Transform.escapeTags( String.valueOf( event.getLevel() ) ) );
sbuf.append( "</font>" );
} else if ( logLevel.isGreaterOrEqual( Level.WARN ) ) {
sbuf.append( "<font color=\"#993300\"><strong>" );
sbuf.append( Transform.escapeTags( String.valueOf( event.getLevel() ) ) );
sbuf.append( "</strong></font>" );
} else {
sbuf.append( Transform.escapeTags( String.valueOf( event.getLevel() ) ) );
}
sbuf.append( "</td>" + Layout.LINE_SEP );
}
if ( showCodeLineColumn() ) {
LocationInfo locInfo = event.getLocationInformation();
sbuf.append( "<td>" );
sbuf.append( Transform.escapeTags( MDC.get( PurgeUtilityLogger.CODE_LINE ) ) );
// sbuf.append( Transform.escapeTags( locInfo.getFileName() ) );
// sbuf.append( ':' );
// sbuf.append( locInfo.getLineNumber() );
sbuf.append( "</td>" + Layout.LINE_SEP );
}
sbuf.append( "<td title=\"Message\">" );
sbuf.append( Transform.escapeTags( event.getRenderedMessage() ) );
sbuf.append( "</td>" + Layout.LINE_SEP );
sbuf.append( "</tr>" + Layout.LINE_SEP );
if ( event.getNDC() != null ) {
sbuf.append( "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : "
+ "xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">" );
sbuf.append( "NDC: " + Transform.escapeTags( event.getNDC() ) );
sbuf.append( "</td></tr>" + Layout.LINE_SEP );
}
String[] s = event.getThrowableStrRep();
if ( s != null ) {
sbuf.append( "<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : xx-small;\" colspan=\"6\">" );
appendThrowableAsHTML( s, sbuf );
sbuf.append( "</td></tr>" + Layout.LINE_SEP );
}
return sbuf.toString();
}