Examples of format()


Examples of org.apache.log.format.RawFormatter.format()

    public void testRawFormatter()
    {
        final Formatter formatter = new RawFormatter();

        final String result1 = formatter.format( E1 );
        final String result2 = formatter.format( E2 );
        final String result3 = formatter.format( E3 );

        assertEquals( "Raw formatting of E1", E1.getMessage(), result1 );
        assertEquals( "Raw formatting of E2", E2.getMessage(), result2 );
View Full Code Here

Examples of org.apache.log.format.SyslogFormatter.format()

    public void testSyslogFormatter()
    {
        final Formatter formatter = new SyslogFormatter( FACILITY_ID, false );

        final String result1 = formatter.format( E1 );
        final String result2 = formatter.format( E2 );
        final String result3 = formatter.format( E3 );

        assertEquals( "SYSLOG formatting of E1", E1_SYSLOG, result1 );
        assertEquals( "SYSLOG formatting of E2", E2_SYSLOG, result2 );
View Full Code Here

Examples of org.apache.log.format.XMLFormatter.format()

    public void testXMLFormatter()
    {
        final Formatter formatter = new XMLFormatter();

        final String result1 = formatter.format( E1 );
        final String result2 = formatter.format( E2 );
        final String result3 = formatter.format( E3 );

        assertEquals( "XML formatting of E1", E1_XML, result1 );
        assertEquals( "XML formatting of E2", E2_XML, result2 );
View Full Code Here

Examples of org.apache.log4j.Layout.format()

        NDC.push(ndcMessage);
        LoggingEvent event =
          new LoggingEvent(
            "com.example.bar", logger, level, "Hello, World", null);
        Layout layout = createLayout();
        String result = layout.format(event);
        NDC.clear();
        Element parsedResult = parse(result);
        NodeList ndcs = parsedResult.getElementsByTagName("log4j:NDC");
        assertEquals(1, ndcs.getLength());
        StringBuffer buf = new StringBuffer();
View Full Code Here

Examples of org.apache.log4j.helpers.AbsoluteTimeDateFormat.format()

                runningLate = j.schedDate <= delayedTime;
                if (runningLate) {
                    delayedCount++;
                }
                if (__log.isDebugEnabled())
                    __log.debug("todo.enqueue job from db: " + j.jobId.trim() + " for " + j.schedDate + "(" + f.format(j.schedDate)+") "+(runningLate?" delayed=true":""));
                enqueue(j);
            }
            if (delayedCount > 0) {
                __log.warn("Dispatching jobs with more than "+(_warningDelay/60000)+" minutes delay. Either the server was down for some time or the job load is greater than available capacity");
            }
View Full Code Here

Examples of org.apache.log4j.helpers.ISO8601DateFormat.format()

        // excess buffer copies here, and appending into an OutputBuffer.
        byte[] data;
        if (FAKE_LOG4J_HEADER) {
          StringBuilder result = new StringBuilder();
          ISO8601DateFormat dateFormat = new org.apache.log4j.helpers.ISO8601DateFormat();
          result.append(dateFormat.format(new java.util.Date()));
          result.append(" INFO org.apache.hadoop.chukwa.");
          result.append(type);
          result.append("= ");
          result.append(o.get("exitValue"));
          result.append(": ");
View Full Code Here

Examples of org.apache.log4j.helpers.PatternConverter.format()

    }
   
    PatternConverter c = head;

    while(c != null) {
      c.format(sbuf, event);
      c = c.next;
    }
    return sbuf.toString();
  }
}
View Full Code Here

Examples of org.apache.log4j.pattern.CachedDateFormat.format()

    //     are optimized to reuse previous formatted value
    //     make a couple of nearly spaced calls
    DateFormat gmtFormat = new CachedDateFormat(createAbsoluteTimeDateFormat(GMT), 1000);
    long ticks = 12601L * 86400000L;
    Date jul1 = new Date(ticks);
    assertEquals("00:00:00,000", gmtFormat.format(jul1));
    Date plus8ms = new Date(ticks + 8);
    assertEquals("00:00:00,008", gmtFormat.format(plus8ms));
    Date plus17ms = new Date(ticks + 17);
    assertEquals("00:00:00,017", gmtFormat.format(plus17ms));
    Date plus237ms = new Date(ticks + 237);
View Full Code Here

Examples of org.apache.log4j.pattern.PatternConverter.format()

  String computeSubject(LoggingEvent triggeringEvent) {
    PatternConverter c = this.subjectConverterHead;
    StringWriter sw = new StringWriter();
    try {
      while (c != null) {
        c.format(sw, triggeringEvent);
        c = c.next;
      }
    } catch(java.io.IOException ie) {
      // this should not happen
    }
View Full Code Here

Examples of org.apache.log4j.xml.XMLLayout.format()

          new PrintWriter(new BufferedWriter(new FileWriter(selectedFile)));

        while (iter.hasNext()) {
          event = (LoggingEvent) iter.next();
          layout.setLocationInfo(event.getThrowableInformation() != null);
          out.write(layout.format(event));
        }
      } catch (IOException ioe) {
        ioe.printStackTrace();
      } finally {
        if (out != null) {
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.