org.apache.log4j.helpers.PatternConverter Java Examples

The following examples show how to use org.apache.log4j.helpers.PatternConverter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PatternLayout.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   Produces a formatted string as specified by the conversion pattern.
*/
public String format(LoggingEvent event) {
  // Reset working stringbuffer
  if(sbuf.capacity() > MAX_CAPACITY) {
    sbuf = new StringBuffer(BUF_SIZE);
  } else {
    sbuf.setLength(0);
  }

  PatternConverter c = head;

  while(c != null) {
    c.format(sbuf, event);
    c = c.next;
  }
  return sbuf.toString();
}
 
Example #2
Source File: ExtendedPatternParser.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void finalizeConverter(char c) {
    PatternConverter pc = null;

    switch (c) {
        case 'H':
            pc = new HeaderPatternConverter(formattingInfo);
            currentLiteral.setLength(0);
            break;
    }

    if (pc != null) {
        addConverter(pc);
    } else {
        super.finalizeConverter(c);
    }
}