Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-19396] use less verbose logging format for Maven 3 builds
- Loading branch information
Showing
3 changed files
with
52 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package hudson.maven; | ||
|
||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
import java.util.logging.Formatter; | ||
import java.util.logging.Level; | ||
import java.util.logging.LogRecord; | ||
|
||
public class MavenConsoleFormatter extends Formatter { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
// Line separator string. This is the value of the line.separator | ||
// property at the moment that the SimpleFormatter was created. | ||
private final String lineSeparator = System.getProperty("line.separator"); | ||
|
||
@Override | ||
public String format(LogRecord record) { | ||
String message = formatMessage(record); | ||
String level = record.getLevel() == Level.SEVERE ? "ERROR" : record.getLevel().getName(); | ||
String logMsg = "[" + level | ||
+ "] " | ||
+ message | ||
+ lineSeparator; | ||
if (record.getThrown() != null) { | ||
try { | ||
StringWriter sw = new StringWriter(); | ||
PrintWriter pw = new PrintWriter(sw); | ||
record.getThrown().printStackTrace(pw); | ||
pw.close(); | ||
logMsg += sw.toString(); | ||
} catch (Exception ex) { | ||
} | ||
} | ||
return logMsg; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note to self: shouldn't be public, so that I doesn't become part of the API