Skip to content

Instantly share code, notes, and snippets.

@ExC0d3
Created April 21, 2020 18:33
Show Gist options
  • Select an option

  • Save ExC0d3/0e3eaf4ba424dfd652a8c00e894201df to your computer and use it in GitHub Desktop.

Select an option

Save ExC0d3/0e3eaf4ba424dfd652a8c00e894201df to your computer and use it in GitHub Desktop.
log4j stack trace with formatting.
package com.weareethic.vertx;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class Test {
public static void call(int i) {
if (i == 0) {
throw new IllegalArgumentException("Reached argument 0");
} else {
call(--i);
}
}
public static void main(String[] args) {
try {
call(10);
} catch (Exception e) {
log.error("Error in [{}]", Thread.currentThread().getName(), e);
}
}
}
/**
*
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment