Examples of PatternFormatter


Examples of org.rzo.yajsw.log.PatternFormatter

   *
   * @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;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.