Package net.sf.logsaw.dialect.pattern

Examples of net.sf.logsaw.dialect.pattern.APatternDialect.configure()


        getLogResource().synchronize(coll, null);
        fail("Should throw exception because it is not configured");
      } catch (AssertionFailedException e) {
        // should be configured
      }
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d %-5p [%c] (%t) %m%n");
      getLogResource().synchronize(coll, null);
      assertEquals(4, list.size());
      assertEquals(4, coll.getTotalCollected());
     
      assertEquals("INFO", list.get(1).get(Log4JFieldProvider.FIELD_LEVEL).getName());
View Full Code Here


        protected boolean doCollect(LogEntry entry) throws IOException {
          list.add(entry);
          return true;
        }
      };
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d{ABSOLUTE} %-5p - %m (%F:%M:%L)%n");
      getLogResource().synchronize(coll, null);
      assertEquals(5, list.size());
      assertEquals(5, coll.getTotalCollected());
     
      assertEquals("Creating dependent components for: jboss.system:type=Log4jService,service=Logging dependents are: []", list.get(4).get(Log4JFieldProvider.FIELD_MESSAGE));
View Full Code Here

        protected boolean doCollect(LogEntry entry) throws IOException {
          list.add(entry);
          return true;
        }
      };
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d{ABSOLUTE} %-5p - %m (%t)%n");
      getLogResource().synchronize(coll, null);
      assertEquals(4, list.size());
      assertEquals(4, coll.getTotalCollected());
      assertEquals(1, coll.getMessages().size());
    } catch (Exception e) {
View Full Code Here

        protected boolean doCollect(LogEntry entry) throws IOException {
          list.add(entry);
          return true;
        }
      };
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d{yyyy-MM-dd HH:mm:ss,SSS} %p %t %x %c%n %m%n%n");
      getLogResource().synchronize(coll, null);
      assertEquals(5, list.size());
      assertEquals(5, coll.getTotalCollected());
     
      assertTrue(list.get(1).get(Log4JFieldProvider.FIELD_MESSAGE).contains("   at FlexNet.SystemServices.ComponentFactory.BusinessComponentMethod.Invoke()"));
View Full Code Here

        protected boolean doCollect(LogEntry entry) throws IOException {
          list.add(entry);
          return true;
        }
      };
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d %-5p [%c] %m%n");
      getLogResource().synchronize(coll, null);
      assertEquals(3, list.size());
      assertEquals(3, coll.getTotalCollected());
     
      assertEquals("INFO", list.get(0).get(Log4JFieldProvider.FIELD_LEVEL).getName());
View Full Code Here

        protected boolean doCollect(LogEntry entry) throws IOException {
          list.add(entry);
          return true;
        }
      };
      dialect.configure(APatternDialect.OPTION_PATTERN, "%p %t %c - %m%n");
      getLogResource().synchronize(coll, null);
      assertEquals(15, list.size());
      assertEquals(15, coll.getTotalCollected());
     
      assertEquals("INFO", list.get(12).get(Log4JFieldProvider.FIELD_LEVEL).getName());
View Full Code Here

  public void testNoTimestampAutoTruncate() {
    try {
      loadLogFile("no-timestamp.log.txt");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      APatternDialect dialect = (APatternDialect) getLogResource().getDialect();
      dialect.configure(APatternDialect.OPTION_PATTERN, "%p %t %c - %m%n");
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      SynchronizationResult result = indexService.synchronize(getLogResource(), null);
      assertEquals(15, result.getNumberOfEntriesAdded());
      assertEquals(15, indexService.count(getLogResource()));
      result = indexService.synchronize(getLogResource(), null);
View Full Code Here

  @Test
  public void testGetAllFields() {
    APatternDialect dialect = (APatternDialect) createLogDialect();
    try {
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d %-5p [%c] (%t) %m%n");
    } catch (CoreException e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
    int oldSize = dialect.getFieldProvider().getAllFields().size();
View Full Code Here

  @Test
  public void testGetDefaultFields() {
    APatternDialect dialect = (APatternDialect) createLogDialect();
    try {
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d %-5p [%c] (%t) %m%n");
    } catch (CoreException e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
    int oldSize = dialect.getFieldProvider().getDefaultFields().size();
View Full Code Here

  @Test
  public void testTimestampField() {
    APatternDialect dialect = (APatternDialect) createLogDialect();
    try {
      dialect.configure(APatternDialect.OPTION_PATTERN, "%d %-5p [%c] (%t) %m%n");
    } catch (CoreException e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
    assertNotNull(dialect.getFieldProvider().getTimestampField());
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.