*
* @return the formatter
*/
private PatternFormatter getFormatter(String wFormat)
{
PatternFormatter formatter = new PatternFormatter();
String pattern = "";
if (wFormat.contains("Z"))
{
formatter.setTimeFormat("yy-MM-dd HH:mm:ss.SS");
}
else
{
formatter.setTimeFormat("yy-MM-dd HH:mm:ss");
}
for (int i = 0; i < wFormat.length(); i++)
{
if (i > 0)
pattern += "|";
char c = wFormat.charAt(i);
switch (c)
{
case 'L':
pattern += "%LEVEL%";
break;
case 'P':
pattern += "%PARAM0%";
break;
case 'N':
pattern += "%PARAM1%";
break;
case 'T':
case 'Z':
pattern += "%TIME%";
break;
case 'M':
pattern += "%MESSAGE%";
break;
default:
;
}
}
pattern += "\n";
formatter.setLogPattern(pattern);
return formatter;
}