Skip to content

Commit

Permalink
JENA-1565: Merge commit 'refs/pull/439/head' of https://github.com/ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Jun 25, 2018
2 parents 6788cbf + 842b4a7 commit 3d9b167
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

package org.apache.jena.atlas.logging.java;

import java.text.MessageFormat ;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.MessageFormat;
import java.util.Date ;
import java.util.logging.Formatter ;
import java.util.logging.Level ;
Expand Down Expand Up @@ -89,6 +91,18 @@ public String format(LogRecord record) {
if ( record.getParameters() != null )
formatted$ = MessageFormat.format(formatted$, record.getParameters()) ;

String throwable = "";
Throwable th = record.getThrown();
if ( th != null ) {
// Avoid going via bytes because of the risk of platform character set issues.
StringWriter sw = new StringWriter();
try ( PrintWriter pw = new PrintWriter(sw) ) {
pw.println();
th.printStackTrace(pw);
}
formatted$ = formatted$ + sw.toString();
}

Level level = record.getLevel() ;
String levelOutputName = levelOutputName(level) ;

Expand All @@ -98,7 +112,7 @@ public String format(LogRecord record) {
levelOutputName, // 3
Thread.currentThread().getName(), // 4
new Date(record.getMillis()), // 5
formatted$) ; // 6
formatted$); // 6
}

/** By default use slf4j name.
Expand Down

0 comments on commit 3d9b167

Please sign in to comment.