PatternLayout pl = new PatternLayout();
pl.setContext(lc);
pl.setPattern("%m%n");
pl.start();
ILoggingEvent e = createLoggingEvent(new Exception("x"));
String res = pl.doLayout(e);
// make sure that at least some package data was output
Pattern p = Pattern.compile("\\s*at .*?\\[.*?\\]");
Matcher m = p.matcher(res);
int i = 0;