/** * Set the <b>ConversionPattern</b> option. This is the string which * controls formatting and consists of a mix of literal content and * conversion specifiers. * * @param conversionPattern the conversion pattern */ public void setConversionPattern(String conversionPattern) { pattern = conversionPattern; head = createPatternParser(conversionPattern).parse(); }
/** * Returns PatternParser used to parse the conversion string. Subclasses * may override this to return a subclass of PatternParser which recognize * custom conversion characters. * * @since 0.9.0 * * @param pattern the pattern * @return the parser */ protected PatternParser createPatternParser(String pattern) { return new PatternParser(pattern); }
public AbsoluteTimeDateFormat(TimeZone timeZone) { setCalendar(Calendar.getInstance(timeZone)); }
public DateTimeDateFormat(TimeZone timeZone) { this(); setCalendar(Calendar.getInstance(timeZone)); }
public void setUp() throws Exception { // Setup a console appender appender = new ConsoleHandler(); PatternFormatter layout = new PatternFormatter("%r %-5p [%c{1}] %m%n"); appender.setFormatter(layout); }
/** * Produces a formatted string as specified by the conversion pattern. */ public String format(LogRecord event) { // output buffer appended to when format() is invoked StringBuffer sbuf = new StringBuffer(BUF_SIZE); PatternConverter c = head; while (c != null) { c.format(sbuf, event); c = c.next; } return sbuf.toString(); } }
public String convert(LogRecord event) { String n = getFullyQualifiedName(event); if (precision <= 0) return n; else { int len = n.length(); // We substract 1 from 'len' when assigning to 'end' to avoid out of // bounds exception in return r.substring(end+1, len). This can happen if // precision is 1 and the category name ends with a dot. int end = len - 1; for (int i = precision; i > 0; i--) { end = n.lastIndexOf('.', end - 1); if (end == -1) return n; } return n.substring(end + 1, len); } } }
/** * Constructs a PatternLayout using the supplied conversion pattern. * * @param pattern the pattern */ public PatternFormatter(String pattern) { this.pattern = pattern; head = createPatternParser((pattern == null) ? DEFAULT_CONVERSION_PATTERN : pattern).parse(); }
public AbsoluteTimeDateFormat() { setCalendar(Calendar.getInstance()); }
/** * Returns PatternParser used to parse the conversion string. Subclasses * may override this to return a subclass of PatternParser which recognize * custom conversion characters. * * @since 0.9.0 * * @param pattern the pattern * @return the parser */ protected PatternParser createPatternParser(String pattern) { return new PatternParser(pattern); }
public DateTimeDateFormat(TimeZone timeZone) { this(); setCalendar(Calendar.getInstance(timeZone)); }
public void setUp() throws Exception { // Setup a console appender appender = new ConsoleHandler(); PatternFormatter layout = new PatternFormatter("%r %-5p [%c{1}] %m%n"); appender.setFormatter(layout); }
/** * Produces a formatted string as specified by the conversion pattern. */ public String format(LogRecord event) { // output buffer appended to when format() is invoked StringBuffer sbuf = new StringBuffer(BUF_SIZE); PatternConverter c = head; while (c != null) { c.format(sbuf, event); c = c.next; } return sbuf.toString(); } }
public String convert(LogRecord event) { String n = getFullyQualifiedName(event); if (precision <= 0) return n; else { int len = n.length(); // We substract 1 from 'len' when assigning to 'end' to avoid out of // bounds exception in return r.substring(end+1, len). This can happen if // precision is 1 and the category name ends with a dot. int end = len - 1; for (int i = precision; i > 0; i--) { end = n.lastIndexOf('.', end - 1); if (end == -1) return n; } return n.substring(end + 1, len); } } }
/** * Set the <b>ConversionPattern</b> option. This is the string which * controls formatting and consists of a mix of literal content and * conversion specifiers. * * @param conversionPattern the conversion pattern */ public void setConversionPattern(String conversionPattern) { pattern = conversionPattern; head = createPatternParser(conversionPattern).parse(); }
public AbsoluteTimeDateFormat() { setCalendar(Calendar.getInstance()); }
/** * Constructs a PatternLayout using the supplied conversion pattern. * * @param pattern the pattern */ public PatternFormatter(String pattern) { this.pattern = pattern; head = createPatternParser((pattern == null) ? DEFAULT_CONVERSION_PATTERN : pattern).parse(); }
public AbsoluteTimeDateFormat(TimeZone timeZone) { setCalendar(Calendar.getInstance(timeZone)); }