Java Code Examples for java.util.logging.LogRecord

The following are top voted examples for showing how to use java.util.logging.LogRecord. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: MooProject   File: ConciseFormatter.java   Source Code and License 7 votes vote down vote up
@Override
@SuppressWarnings("ThrowableResultIgnored")
public String format(LogRecord record) {
    StringBuilder formatted = new StringBuilder();

    formatted.append("[");
    formatted.append(date.format(record.getMillis()));
    formatted.append(" ");
    formatted.append(record.getLevel().getName());
    formatted.append("] ");
    formatted.append(stripColors ? ConsoleColor.stripColors(formatMessage(record)) : formatMessage(record));
    formatted.append('\n');

    if(record.getThrown() != null) {
        StringWriter writer = new StringWriter();
        record.getThrown().printStackTrace(new PrintWriter(writer));
        formatted.append(writer);
    }
    return formatted.toString();
}
 
Example 2
Project: monarch   File: LogWrapper.java   Source Code and License 6 votes vote down vote up
private LogWrapper() {
  logger = Logger.getLogger(this.getClass().getCanonicalName());

  Cache cache = CliUtil.getCacheIfExists();
  if (cache != null && !cache.isClosed()) {
    // TODO - Abhishek how to set different log levels for different handlers???
    logger.addHandler(cache.getLogger().getHandler());
    CommandResponseWriterHandler handler = new CommandResponseWriterHandler();
    handler.setFilter(new Filter() {
      @Override
      public boolean isLoggable(LogRecord record) {
        return record.getLevel().intValue() >= Level.FINE.intValue();
      }
    });
    handler.setLevel(Level.FINE);
    logger.addHandler(handler);
  }
  logger.setUseParentHandlers(false);
}
 
Example 3
Project: jboss-eap7.1-playground   File: PlaygroundFormatter.java   Source Code and License 6 votes vote down vote up
/**
 * Format the given LogRecord.
 * 
 * @param record
 *            the log record to be formatted.
 * @return a formatted log record
 */
@Override
public String format(LogRecord record) {

	StringBuilder sb = new StringBuilder();

	LocalDateTime time = Instant.ofEpochMilli(record.getMillis()).atZone(ZoneId.systemDefault()).toLocalDateTime();

	sb.append(TIME_FORMAT.format(time)).append(" [")
	  .append(record.getLevel())
	  .append("] ")
	  .append(record.getSourceClassName())
	  .append(".")
	  .append(record.getSourceMethodName())
	  .append("  ")
	  .append(record.getMessage())
	  .append("\n");

	return sb.toString();
}
 
Example 4
Project: Pogamut3   File: SimpleLogging.java   Source Code and License 6 votes vote down vote up
public static void addConsoleLogging() {
	Logger log = Logger.getAnonymousLogger();
	while (log != null) {
		if (log.getParent() == null) {
			log.addHandler(new Handler() {
				
				@Override
				public void close() throws SecurityException {
				}

				@Override
				public void flush() {
				}

				@Override
				public void publish(LogRecord record) {
					System.out.println("[" + record.getLevel() + "] " + record.getMessage());
				}
				
			});
		}
		log = log.getParent();
	}	
}
 
Example 5
Project: L2jBrasil   File: ChatLogFormatter.java   Source Code and License 6 votes vote down vote up
@Override
public String format(LogRecord record)
{
	Object[] params = record.getParameters();
       StringBuilder output = new StringBuilder();
	output.append('[');
	output.append(dateFmt.format(new Date(record.getMillis())));
	output.append(']');
	output.append(' ');
	if (params != null)
	{
		for (Object p : params)
		{
			output.append(p);
			output.append(' ');
		}
	}
	output.append(record.getMessage());
	output.append(CRLF);

	return output.toString();
}
 
Example 6
Project: L2jBrasil   File: FileLogFormatter.java   Source Code and License 6 votes vote down vote up
@Override
public String format(LogRecord record)
{
       StringBuilder output = new StringBuilder();

	return output
	.append(dateFmt.format(new Date(record.getMillis())))
	.append(underscore)
	.append(record.getLevel().getName())
	.append(underscore)
	.append(record.getThreadID())
	.append(underscore)
	.append(record.getLoggerName())
	.append(underscore)
	.append(record.getMessage())
	.append(CRLF)
	.toString();
}
 
Example 7
Project: XXXX   File: Logger.java   Source Code and License 6 votes vote down vote up
/**
 * Helper that configures java.util.logging to sanely log messages at FINE level without additional
 * formatting.
 */
public JavaLogger appendToFile(String logfile) {
  logger.setLevel(java.util.logging.Level.FINE);
  try {
    FileHandler handler = new FileHandler(logfile, true);
    handler.setFormatter(new SimpleFormatter() {
      @Override
      public String format(LogRecord record) {
        return String.format("%s%n", record.getMessage()); // NOPMD
      }
    });
    logger.addHandler(handler);
  } catch (IOException e) {
    throw new IllegalStateException("Could not add file handler.", e);
  }
  return this;
}
 
Example 8
Project: L2jBrasil   File: L2ItemInstance.java   Source Code and License 6 votes vote down vote up
/**
 * Sets the quantity of the item.<BR><BR>
 * <U><I>Remark :</I></U> If loc and loc_data different from database, say datas not up-to-date
 * @param process : String Identifier of process triggering this action
 * @param count : int
 * @param creator : L2PcInstance Player requesting the item creation
 * @param reference : L2Object Object referencing current action like NPC selling item or previous item in transformation
 */
public void changeCount(String process, int count, L2PcInstance creator, L2Object reference)
{
       if (count == 0) return;
       if ( count > 0 && _count > Integer.MAX_VALUE - count) _count = Integer.MAX_VALUE;
       else _count += count;
       if (_count < 0) _count = 0;
       _storedInDb = false;

	if (Config.LOG_ITEMS)
	{
		LogRecord record = new LogRecord(Level.INFO, "CHANGE:" + process);
		record.setLoggerName("item");
		record.setParameters(new Object[]{this, creator, reference});
		_logItems.log(record);
	}
}
 
Example 9
Project: incubator-netbeans   File: SingleModuleProperties.java   Source Code and License 6 votes vote down vote up
/** Sends info to UI handler about NetBeans APIs in use
 */
private static void logNetBeansAPIUsage(String msg, Collection<ModuleDependency> deps) {
    List<String> cnbs = new ArrayList<String>();
    for (ModuleDependency moduleDependency : deps) {
        String cnb = moduleDependency.getModuleEntry().getCodeNameBase();
        // observe just NetBeans API module usage
        if (cnb.startsWith("org.openide") || cnb.startsWith("org.netbeans")) { // NOI18N
            cnbs.add(cnb);
        }
    }

    if (cnbs.isEmpty()) {
        return;
    }

    LogRecord rec = new LogRecord(Level.CONFIG, msg);
    rec.setParameters(cnbs.toArray(new String[0]));
    rec.setResourceBundleName(SingleModuleProperties.class.getPackage().getName() + ".Bundle"); // NOI18N
    rec.setResourceBundle(NbBundle.getBundle(SingleModuleProperties.class));
    rec.setLoggerName(UI_LOG.getName());
    UI_LOG.log(rec);
}
 
Example 10
Project: incubator-netbeans   File: HandlerTest.java   Source Code and License 6 votes vote down vote up
public void testLoggingMessageWithBundleAndArg() throws Exception {
    FileObject dir  = TimesCollectorPeerTest.makeScratchDir(this);
    
    Logger LOG = Logger.getLogger("TIMER.instance.of.my.object");
    LogRecord rec = new LogRecord(Level.FINE, "LOG_ProjectWithArg"); // NOI18N
    rec.setParameters(new Object[] { dir, dir, "Lovely" });
    rec.setResourceBundle(ResourceBundle.getBundle(HandlerTest.class.getName()));
    LOG.log(rec);

    Collection<Object> files = TimesCollectorPeer.getDefault().getFiles();
    assertEquals("One object " + files, 1, files.size());
    
    Description descr = TimesCollectorPeer.getDefault().getDescription(files.iterator().next(), "LOG_ProjectWithArg");
    assertNotNull(descr);
    
    if (descr.getMessage().indexOf("My Lovely Project") == -1) {
        fail("Localized msg should contain 'My Lovely Project': " + descr.getMessage());
    }
}
 
Example 11
Project: java-logging-benchmarks   File: Log4JFormatter.java   Source Code and License 6 votes vote down vote up
@Override
public String format(LogRecord record) {
    // %d [%t] %p %c - %m%n
    StringBuilder buf = new StringBuilder(256);
    buf.append(new Date(record.getMillis()));
    buf.append(" [");
    buf.append(
            Thread.currentThread().getId() == record.getThreadID() ? Thread.currentThread().getName() : "Unknown");
    buf.append("] ");
    buf.append(record.getLevel().getName());
    buf.append(' ');
    buf.append(record.getLoggerName());
    buf.append(" - ");
    if (record.getParameters() == null) {
        buf.append(record.getMessage());
    } else {
        buf.append(String.format(record.getMessage(), record.getParameters()));
    }
    buf.append('\n');
    return buf.toString();
}
 
Example 12
Project: incubator-netbeans   File: FolderObj.java   Source Code and License 6 votes vote down vote up
private void createData(final File file2Create) throws IOException {
    boolean isSupported = new FileInfo(file2Create).isSupportedFile();                        
    ProvidedExtensions extensions =  getProvidedExtensions();
    
    if (!isSupported) {             
        extensions.createFailure(this, file2Create.getName(), false);
        FSException.io("EXC_CannotCreateData", file2Create.getName(), getPath());// NOI18N
    } else if (FileChangedManager.getInstance().exists(file2Create)) {
        extensions.createFailure(this, file2Create.getName(), false);
        SyncFailedException sfe = new SyncFailedException(file2Create.getAbsolutePath()); // NOI18N               
        String msg = NbBundle.getMessage(FileBasedFileSystem.class, "EXC_CannotCreateData", file2Create.getName(), getPath()); // NOI18N
        Exceptions.attachLocalizedMessage(sfe, msg);
        throw sfe;
    } else if (!file2Create.createNewFile()) {
        extensions.createFailure(this, file2Create.getName(), false);            
        FSException.io("EXC_CannotCreateData", file2Create.getName(), getPath());// NOI18N
    }        
    LogRecord r = new LogRecord(Level.FINEST, "DataCreated: "+ file2Create.getAbsolutePath());
    r.setParameters(new Object[] {file2Create});
    Logger.getLogger("org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj").log(r);        
}
 
Example 13
Project: incubator-netbeans   File: ConstrainedBinaryIndexerTest.java   Source Code and License 6 votes vote down vote up
MockConstrainedIndexer() {
    h = new Handler() {
        @Override
        public void publish(LogRecord record) {
            if (record.getMessage().equals("RootsWork-finished")) {
                sem.release();
            }
        }
        @Override
        public void flush() {
        }

        @Override
        public void close() throws SecurityException {
        }
    };
    final Logger log = Logger.getLogger(RepositoryUpdater.class.getName() + ".tests"); //NOI18N
    log.setLevel(Level.FINEST);
    log.addHandler(h);
}
 
Example 14
Project: incubator-netbeans   File: ChildrenInitializedMeanwhileTest.java   Source Code and License 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    EntrySupportLazy.LOGGER.addHandler(new java.util.logging.Handler() {
        {
            setLevel(Level.FINER);
            EntrySupportLazy.LOGGER.setLevel(Level.FINER);
        }
        @Override
        public void publish(LogRecord record) {
            if (record.getMessage().startsWith("setEntries():")) {
                notifyRecordIsHere();
            }
        }

        @Override
        public void flush() {
        }

        @Override
        public void close() throws SecurityException {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        
    });
}
 
Example 15
Project: incubator-netbeans   File: Exceptions.java   Source Code and License 6 votes vote down vote up
private void logRecords(Appendable a) {
    List<LogRecord> r = records;
    if (r == null) {
        return;
    }
    try {

        for (LogRecord log : r) {
            if (log.getMessage() != null) {
                a.append(log.getMessage()).append("\n");;
            }
            if (log.getThrown() != null) {
                StringWriter w = new StringWriter();
                log.getThrown().printStackTrace(new PrintWriter(w));
                a.append(w.toString()).append("\n");
            }
        }
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}
 
Example 16
Project: incubator-netbeans   File: LogRecordsTest.java   Source Code and License 6 votes vote down vote up
public void testNFE() throws IOException{
    InputStream stream = getClass().getResourceAsStream("issue140886");
    rec = null;
    Handler h = new Handler(){
        public void publish(LogRecord record) {
            rec = record;
        }
        @Override public void flush() {}
        @Override public void close() throws SecurityException {}
    };
    LogRecords.scan(stream, h);
    assertNotNull("Whole file is parsed", rec);
    assertEquals("UI_ACTION_EDITOR", rec.getMessage());
    assertEquals(5, rec.getParameters().length);
    
}
 
Example 17
Project: incubator-netbeans   File: MIMESupport69049Test.java   Source Code and License 6 votes vote down vote up
public synchronized void publish(LogRecord r) {
    String s = r.getMessage();
    if (s.startsWith ("Computing resolvers")) {
        notifyAll();
        if (block) {
            try {
                wait(200);
            } catch (InterruptedException ex) {
                fail("Wrong exception");
            }
        }
    }
    
    if (s.startsWith("Resolvers computed")) {
        block = false;
        notifyAll();
    }
}
 
Example 18
Project: incubator-netbeans   File: UINodeTest.java   Source Code and License 6 votes vote down vote up
public void testIconOfTheNode() throws Exception {
    LogRecord r = new LogRecord(Level.INFO, "icon_msg");
    r.setResourceBundleName("org.netbeans.modules.uihandler.TestBundle");
    r.setResourceBundle(ResourceBundle.getBundle("org.netbeans.modules.uihandler.TestBundle"));
    r.setParameters(new Object[] { new Integer(1), "Ahoj" });
    
    Node n = UINode.create(r);
    assertEquals("Name is taken from the message", "icon_msg", n.getName());
    
    if (!n.getDisplayName().matches(".*Ahoj.*")) {
        fail("wrong display name, shall contain Ahoj: " + n.getDisplayName());
    }
    
    Image img = n.getIcon(BeanInfo.ICON_COLOR_32x32);
    assertNotNull("Some icon", img);
    IconInfo imgReal = new IconInfo(img);
    IconInfo template = new IconInfo(getClass().getResource("testicon.png"));
    assertEquals("Icon from ICON_BASE used", template, imgReal);
    
    assertSerializedWell(n);
}
 
Example 19
Project: incubator-netbeans   File: StatusTest.java   Source Code and License 6 votes vote down vote up
/**
 * It seems that cache.listFiles and cache.containsFiles called getStatus also on folders. Because folders are usually up-to-date (git does not track them),
 * this results in unnecessary call to getOwner, ignore logic or sharability.
 */
public void testSkipFoldersBug196702 () throws Exception {
    final File f1 = new File(repositoryLocation, "1");
    final File f2 = new File(f1, "2");
    final File f3 = new File(f2, "3");
    f3.mkdirs();
    File f = new File(f3, "f");
    f.createNewFile();
    
    FileStatusCache cache = getCache();
    cache.refreshAllRoots(Collections.<File, Collection<File>>singletonMap(repositoryLocation, Collections.singleton(f1)));
    Logger log = Logger.getLogger("org.netbeans.modules.git.status.cache");
    final boolean[] flags = new boolean[1];
    log.addHandler(new Handler() {
        @Override
        public void publish (LogRecord record) {
            if (record.getMessage().startsWith("getCachedStatus for file {0}:")) {
                if (Arrays.asList(f1, f2, f3).contains((File) record.getParameters()[0])) {
                    flags[0] = true;
                }
            }
        }

        @Override
        public void flush () { }

        @Override
        public void close () throws SecurityException { }
    });
    
    Collection<File> newFiles = Arrays.asList(cache.listFiles(new File[] { f1 }, EnumSet.of(FileInformation.Status.NEW_INDEX_WORKING_TREE)));
    assertEquals(Arrays.asList(f), newFiles);
    assertFalse(flags[0]);
    flags[0] = false;
    assertTrue(cache.containsFiles(Collections.singleton(f1), EnumSet.of(FileInformation.Status.NEW_INDEX_WORKING_TREE), true));
    assertFalse(flags[0]);
    assertFalse(cache.containsFiles(Collections.singleton(f1), EnumSet.of(FileInformation.Status.MODIFIED_INDEX_WORKING_TREE), true));
    assertFalse(flags[0]);
    
    // test we do not break anything with the bugfix: ignored files/folders should be recognized even without getStatus call
    SystemAction.get(IgnoreAction.class).performAction(VCSContext.forNodes(new Node[] { new AbstractNode(Children.LEAF, Lookups.fixed(f1)) }));
    flags[0] = false;
    Collection<File> ignoredFiles = Arrays.asList(cache.listFiles(new File[] { f1 }, EnumSet.of(FileInformation.Status.NOTVERSIONED_EXCLUDED)));
    assertEquals(Arrays.asList(f1), ignoredFiles);
    assertFalse(flags[0]);
    flags[0] = false;
    assertTrue(cache.containsFiles(Collections.singleton(f1), EnumSet.of(FileInformation.Status.NOTVERSIONED_EXCLUDED), true));
    assertFalse(flags[0]);
}
 
Example 20
Project: Uranium   File: ForwardLogHandler.java   Source Code and License 6 votes vote down vote up
@Override
public void publish(LogRecord record) {
    Logger logger = getLogger(record.getLoggerName());
    Throwable exception = record.getThrown();
    Level level = record.getLevel();
    String message = getFormatter().formatMessage(record);

    if (level == Level.SEVERE) {
        logger.error(message, exception);
    } else if (level == Level.WARNING) {
        logger.warn(message, exception);
    } else if (level == Level.INFO) {
        logger.info(message, exception);
    } else if (level == Level.CONFIG) {
        logger.debug(message, exception);
    } else {
        logger.trace(message, exception);
    }
}
 
Example 21
Project: stf-console-client   File: SimpleConsoleFormatter.java   Source Code and License 6 votes vote down vote up
private String formatThrowable(LogRecord record) {
    String throwable = "";
    if (record.getThrown() != null) {
        if (record.getLevel() == Level.WARNING) {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            pw.println();
            record.getThrown().printStackTrace(pw);
            pw.close();
            throwable = sw.toString();
        } else {
            throwable = record.getThrown().getMessage();
        }
    }
    return throwable;
}
 
Example 22
Project: java-logging-benchmarks   File: LogbackFormatter.java   Source Code and License 6 votes vote down vote up
@Override
    public String format(LogRecord record) {
//        <pattern>%d{HH:mm:ss.SSS} [%t] %level{WARN=WARN_, DEBUG=DEBUG, ERROR=ERROR, TRACE=TRACE, INFO=INFO_} %c{36}
// - %m%n</pattern>

        // %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
        StringBuilder buf = new StringBuilder(256);
        buf.append(dateFmt.get().format(new Date(record.getMillis())));
        buf.append(" [");
        buf.append(
                Thread.currentThread().getId() == record.getThreadID() ? Thread.currentThread().getName() : "Unknown");
        buf.append("] ");
        buf.append(record.getLevel().getName());
        buf.append(' ');
        buf.append(abbreviateClassName(record.getLoggerName(), 36));
        buf.append(" - ");
        if (record.getParameters() == null) {
            buf.append(record.getMessage());
        } else {
            buf.append(MessageFormat.format(record.getMessage(), record.getParameters()));
        }
        buf.append('\n');
        return buf.toString();
    }
 
Example 23
Project: incubator-netbeans   File: LogFormatterTest.java   Source Code and License 6 votes vote down vote up
public void testFormat() throws IOException {
    LogRecord rec = new LogRecord(Level.SEVERE, "PROBLEM");
    Throwable thrown = new NullPointerException("TESTING");
    thrown.initCause(new AssertionError("CAUSE PROBLEM"));
    rec.setThrown(thrown);
    String result = new LogFormatter().format(rec);
    assertTrue(result.contains("java.lang.NullPointerException: TESTING"));
    assertTrue(result.contains("<level>1000</level>"));
    assertTrue(result.contains("<method>testFormat</method>"));
    assertTrue(result.contains("<message>java.lang.AssertionError: CAUSE PROBLEM</message>"));
    assertTrue(result.contains("<more>"));
    assertTrue(result.contains("</more>"));
    assertTrue(result.contains(" <class>junit.framework.TestCase</class>"));
    assertTrue(result.contains("<class>sun.reflect.NativeMethodAccessorImpl</class>"));
    assertFalse(result.contains("<more>80</more>"));
}
 
Example 24
Project: incubator-netbeans   File: AfterRestartExceptions.java   Source Code and License 6 votes vote down vote up
private static String getScheduledThrownClassName(LogRecord record) {
    Throwable thrown = record.getThrown();
    if (thrown == null) {
        return null;
    }
    Throwable cause;
    while (((cause = thrown.getCause()) != null) && (cause.getStackTrace().length != 0)){
        thrown = cause;
    }
    String thrownClassName = thrown.getClass().getName();
    if (scheduledThrowableClasses.contains(thrownClassName)) {
        return thrownClassName;
    } else {
        return null;
    }
}
 
Example 25
Project: JDHttpAPI   File: HttpAPIExtension.java   Source Code and License 6 votes vote down vote up
private void startServer() {
    HttpAPIConfig cfg = getSettings();
    server = new Server(cfg.getPort());
    HandlerList lst = new HandlerList();
    LinkController ctr = new JDLinkController(LinkCollector.getInstance());
    if(cfg.getUsePassword() && cfg.getPassword() != null && !cfg.getPassword().equals("")) {
        lst.addHandler(new AuthorizationHandler(cfg.getPassword()));
    }
    lst.addHandler(new AjaxHandler(cfg.getAllowGet()));
    if(cfg.getAllowGet()) {
        lst.addHandler(new JDServerGETHandler(ctr));
    }
    lst.addHandler(new JDServerPOSTHandler(ctr));
    server.setHandler(lst);
    try {
        server.start();
    }
    catch(Exception e) {
        logger.log(new LogRecord(Level.SEVERE, e.getMessage()));
    }
}
 
Example 26
Project: rapidminer   File: LogHandlerModel.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the specified {@link LogRecord} to this model and fires an update.
 * 
 * @param record
 */
private void addLogEntry(LogRecord record) {
	LogRecordEntry newEntry = new LogRecordEntry(record);
	List<LogEntry> newLogEntries = new LinkedList<>();
	newLogEntries.add(newEntry);
	addLogEntries(newLogEntries);
}
 
Example 27
Project: GitHub   File: TestLogHandler.java   Source Code and License 5 votes vote down vote up
@Override public void publish(LogRecord logRecord) {
  if (getFormatter() == null) {
    logs.add(logRecord.getLevel() + ": " + logRecord.getMessage());
  } else {
    logs.add(getFormatter().format(logRecord));
  }
}
 
Example 28
Project: incubator-netbeans   File: MessagesHandlerTest.java   Source Code and License 5 votes vote down vote up
public void testLimitOfMessagesLogFiles() throws Exception {
    clearWorkDir();
    System.setProperty("netbeans.user", getWorkDirPath());
    File logs = new File(getWorkDir(), "logs");
    logs.mkdirs();
    
    MessagesHandler mh = new MessagesHandler(logs, 2, 16);
    
    mh.publish(new LogRecord(Level.INFO, "Hi"));
    mh.flush();
    assertEquals("One file", 1, logs.list().length);
    mh.publish(new LogRecord(Level.INFO, "Message that is longer than 16 bytes"));
    mh.flush();
    assertEquals("Two files", 2, logs.list().length);
    
    mh.publish(new LogRecord(Level.INFO, "Hello!"));
    File ml = new File(logs, "messages.log");
    mh.flush();
    String msg = readLog(ml);
    
    if (msg.indexOf("Hello!") == -1) {
        fail("Contains the Hello! message:\n" + msg);
    }
    if (msg.indexOf("16 bytes!") != -1) {
        fail("Contains no '16 bytes' message:\n" + msg);
    }
}
 
Example 29
Project: incubator-netbeans   File: SlownessReporter.java   Source Code and License 5 votes vote down vote up
private String getParam(LogRecord rec, int index) {
    if (rec.getParameters() != null && rec.getParameters().length > index) {
        return rec.getParameters()[index].toString();
    } else {
        assert rec.getParameters() != null;
        assert rec.getParameters().length > index : Integer.toString(rec.getParameters().length);
    }
    return null;
}
 
Example 30
Project: incubator-netbeans   File: DispatchingHandlerTest.java   Source Code and License 5 votes vote down vote up
@RandomlyFails // NB-Core-Build #9138, #9370: Unstable
public void testContinuousMessagesShouldNotPreventOutput() throws InterruptedException {
    class MyHandler extends Handler {
        final List<LogRecord> records = new CopyOnWriteArrayList<LogRecord>();

        @Override
        public void publish(LogRecord record) {
            records.add(record);
        }

        @Override
        public void flush() {
        }

        @Override
        public void close() throws SecurityException {
            records.clear();
        }
        
    }
    MyHandler mh = new MyHandler();
    DispatchingHandler dh = new DispatchingHandler(mh, 100);
    
    for (int i = 0; i < 100; i++) {
        dh.publish(new LogRecord(Level.INFO, "" + i));
        Thread.sleep(10);
        if (i > 50 && mh.records.isEmpty()) {
            fail("There should be some records when we are at round " + i);
        }
    }
    dh.flush();
    
    assertEquals("One hundered records now", 100, mh.records.size());
}
 
Example 31
Project: incubator-netbeans   File: Util.java   Source Code and License 5 votes vote down vote up
/**
 * Disable logging of logging messages from DatabaseUILogger. See #215375.
 *
 * Usefulness of the whole logger seems to be doubtful
 */
public static void suppressSuperfluousLogging() {
    for (Handler h : Logger.getLogger("").getHandlers()) {
        h.setFilter(new Filter() {
            @Override
            public boolean isLoggable(LogRecord lr) {
                if (lr.getSourceClassName().equals("org.netbeans.modules.db.explorer.DatabaseUILogger")
                        || lr.getSourceClassName().startsWith("org.netbeans.modules.settings.RecognizeInstanceObjects")) {
                    return false;
                } else if (lr.getSourceClassName().equals(
                        "org.netbeans.api.db.sql.support.SQLIdentifiers$DatabaseMetaDataQuoter")) {
                    if (lr.getSourceMethodName().equals("getExtraNameChars")
                            && lr.getLevel() == Level.WARNING
                            && lr.getMessage().startsWith(
                                    "DatabaseMetaData.getExtraNameCharacters() failed")) {
                        return false;
                    } else if (lr.getSourceMethodName().equals("needToQuote")
                            && lr.getLevel().intValue()
                            <= Level.INFO.intValue()) {
                        return false;
                    } else {
                        return true;
                    }
                } else if (lr.getSourceClassName().equals(
                        "org.netbeans.modules.db.explorer.DatabaseConnection") &&
                        lr.getSourceMethodName().equals("doConnect")) {
                    return false;
                } else {
                    return true;
                }
            }
        });
    }
}
 
Example 32
Project: domino   File: SerializableLogRecordMapper.java   Source Code and License 5 votes vote down vote up
public static LogRecord asLogRecord(SerializableLogRecord serializableLogRecord) {
    LogRecord logRecord = new LogRecord(Level.parse(serializableLogRecord.level), serializableLogRecord.message);
    logRecord.setLoggerName(serializableLogRecord.loggerName);
    logRecord.setMillis(serializableLogRecord.millis);
    logRecord.setThrown(JsonLogRecordThrowable.fromJsonString(serializableLogRecord.thrown));
    return logRecord;
}
 
Example 33
Project: L2jBrasil   File: L2ItemInstance.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the ownerID of the item
 * @param process : String Identifier of process triggering this action
 * @param owner_id : int designating the ID of the owner
 * @param creator : L2PcInstance Player requesting the item creation
 * @param reference : L2Object Object referencing current action like NPC selling item or previous item in transformation
 */
public void setOwnerId(String process, int owner_id, L2PcInstance creator, L2Object reference)
{
	setOwnerId(owner_id);
	if (Config.LOG_ITEMS)
	{
		LogRecord record = new LogRecord(Level.INFO, "CHANGE:" + process);
		record.setLoggerName("item");
		record.setParameters(new Object[]{this, creator, reference});
		_logItems.log(record);
	}
}
 
Example 34
Project: incubator-netbeans   File: LookupSensitiveActionUILogTest.java   Source Code and License 5 votes vote down vote up
public void testToolbarPushIsNotified() throws Exception {
       TestSupport.ChangeableLookup lookup = new TestSupport.ChangeableLookup();
       TestLSA tlsa = new TestLSA( lookup );
assertTrue ("TestLSA action is enabled.", tlsa.isEnabled ());
tlsa.refreshCounter = 0;
       TestPropertyChangeListener tpcl = new TestPropertyChangeListener();
       tlsa.addPropertyChangeListener( tpcl );
       lookup.change(d2);
       assertEquals( "Refresh should be called once", 1, tlsa.refreshCounter );
       assertEquals( "One event should be fired", 1, tpcl.getEvents().size() );
       assertTrue("Action is enabled", tlsa.isEnabled());

       tlsa.setDisplayName("Jarda");
    
       JToolBar bar = new JToolBar();
       JButton item = bar.add(tlsa);
       item.doClick();
       
       assertEquals("One record logged:\n" + my.recs, 1, my.recs.size());
       LogRecord r = my.recs.get(0);
       assertEquals("Menu push", "UI_ACTION_BUTTON_PRESS", r.getMessage());
       assertEquals("four args", 5, r.getParameters().length);
       assertEquals("first is the menu item", item, r.getParameters()[0]);
       assertEquals("second is its class", item.getClass().getName(), r.getParameters()[1]);
       assertEquals("3rd is action", tlsa, r.getParameters()[2]);
       assertEquals("4th its class", tlsa.getClass().getName(), r.getParameters()[3]);
       assertEquals("5th name", "Jarda", r.getParameters()[4]);
       
       tlsa.clear();
       tpcl.clear();
       lookup.change(d3);
       assertEquals( "Refresh should be called once", 1, tlsa.refreshCounter );
       assertEquals( "One event should be fired", 1, tpcl.getEvents().size() );        
   }
 
Example 35
Project: openjdk-jdk10   File: PlatformLoggerBridgeTest.java   Source Code and License 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    eventQueue.add(LogEvent.of(sequencer.getAndIncrement(),
            true, record.getLoggerName(),
            record.getSourceClassName(),
            record.getSourceMethodName(),
            PlatformLogger.Level.valueOf(record.getLevel().getName()),
            record.getResourceBundle(), record.getMessage(),
            record.getThrown(), record.getParameters()));
}
 
Example 36
Project: incubator-netbeans   File: InteceptorTest.java   Source Code and License 5 votes vote down vote up
public void publish(LogRecord rec) {
    try {
        Thread.sleep(1000);
    } catch (InterruptedException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example 37
Project: incubator-netbeans   File: LogUtils.java   Source Code and License 5 votes vote down vote up
/**
 * Logs bugtracking events
 *
 * @param key - the events key
 * @param parameters - the parameters for the given event
 */
private static void logBugtrackingEvents(String key, Object[] parameters) {
    LogRecord rec = new LogRecord(Level.INFO, key);
    rec.setParameters(parameters);
    rec.setLoggerName(METRICS_LOG.getName());
    METRICS_LOG.log(rec);
}
 
Example 38
Project: incubator-netbeans   File: Logo.java   Source Code and License 5 votes vote down vote up
@Override
public void mouseClicked(MouseEvent e) {
    LogRecord rec = new LogRecord(Level.INFO, "USG_START_PAGE_LINK"); //NOI18N
    rec.setParameters(new Object[] {url} );
    rec.setLoggerName(Constants.USAGE_LOGGER.getName());
    rec.setResourceBundle(NbBundle.getBundle(BundleSupport.BUNDLE_NAME));
    rec.setResourceBundleName(BundleSupport.BUNDLE_NAME);

    Constants.USAGE_LOGGER.log(rec);
    Utils.showURL( url );
}
 
Example 39
Project: incubator-netbeans   File: DefaultSourceLevelQueryImplTest.java   Source Code and License 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    final String msg = record.getMessage();
    if (msg != null) {
        switch (msg) {
            case "rootCache updated: {0}":
                roots.add((FileObject)record.getParameters()[0]);
                break;
            case "modCache updated: {0}":
                isModular.add((Boolean)record.getParameters()[0]);
                break;
        }
    }
}
 
Example 40
Project: domino   File: RestfulRemoteLogHandler.java   Source Code and License 5 votes vote down vote up
private SerializableLogRecord asSerializableLogRecord(LogRecord record) {
    SerializableLogRecord serializableLogRecord = new SerializableLogRecord();
    serializableLogRecord.level = record.getLevel().toString();
    serializableLogRecord.millis = record.getMillis();
    serializableLogRecord.message = record.getMessage();
    serializableLogRecord.loggerName = record.getLoggerName();
    serializableLogRecord.permutationStrongName = GWT.getPermutationStrongName();
    serializableLogRecord.thrown = serializableThrowable(unwrap(record.getThrown()));
    return serializableLogRecord;
}
 
Example 41
Project: incubator-netbeans   File: MimePathLookupTest.java   Source Code and License 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    final String message = record.getMessage();
    if (message.startsWith("Rebuilding MimeLookup for") && Thread.currentThread().getName().equals("Thread 1")) {
        try {
            // System.out.println("Publish enter");
            barrier.await();
            // System.out.println("Publish waiting");
            Thread.sleep(5000); // Give the other thread a chance to deadlock
            // System.out.println("Publish exit");
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}
 
Example 42
Project: incubator-netbeans   File: AfterRestartExceptions.java   Source Code and License 5 votes vote down vote up
static boolean schedule(LogRecord record) {
    String thrownClassName = getScheduledThrownClassName(record);
    if (thrownClassName != null) {
        if (OutOfMemoryError.class.getName().equals(thrownClassName)) {
            if (ignoreOOME) {
                return true;    // Simulate scheduling, but ignore
            }
            addHeapDump(record);
        }
        return save(record);
    } else {
        return false;
    }
}
 
Example 43
Project: incubator-netbeans   File: ModuleListTest.java   Source Code and License 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    String msg = record.getMessage();
    assertFalse("Duplicate scan of project tree detected: " + msg,
            msg.startsWith("Warning: two modules found with the same code name base"));
    if (msg.startsWith("scanPossibleProject: ") && msg.endsWith("scanned successfully")
            && ! scannedDirs.add(msg)) {
        error = "scanPossibleProject already run: " + msg;
    }
    if (msg.startsWith("scanCluster: ") && msg.endsWith(" succeeded.")
            && ! scannedDirs.add(msg)) {
        error = "scanCluster already run: " + msg;
    }
}
 
Example 44
Project: incubator-netbeans   File: CslTestBase.java   Source Code and License 5 votes vote down vote up
protected ComputedHints getHints(NbTestCase test, Rule hint, String relFilePath, FileObject fileObject, String caretLine) throws Exception {
    ComputedHints hints = computeHints(test, hint, relFilePath, fileObject, caretLine, ChangeOffsetType.NONE);

    if (checkAllHintOffsets()) {
        // Run alternate hint computation AFTER the real computation above since we will destroy the document...
        Logger.global.addHandler(new Handler() {
            @Override
            public void publish(LogRecord record) {
                if (record.getThrown() != null) {
                    StringWriter sw = new StringWriter();
                    record.getThrown().printStackTrace(new PrintWriter(sw));
                    fail("Encountered error: " + sw.toString());
                }
            }

            @Override
            public void flush() {
            }

            @Override
            public void close() throws SecurityException {
            }

        });
        for (ChangeOffsetType type : new ChangeOffsetType[] { ChangeOffsetType.OUTSIDE, ChangeOffsetType.OVERLAP }) {
            computeHints(test, hint, relFilePath, fileObject, caretLine, type);
        }
    }

    return hints;
}
 
Example 45
Project: Pogamut3   File: LogRecordsSource.java   Source Code and License 5 votes vote down vote up
/** Send new data to all listeners. */
public void notifySetNewData() {
    Collection<LogRecord> data = getFilteredData();
    for (LogRecordListener listener : listeners) {
        listener.setNewData(data);
    }
}
 
Example 46
Project: Pogamut3   File: UT2004DeathMatchTournament.java   Source Code and License 5 votes vote down vote up
@Override
public synchronized void run() {
	UT2004DeathMatchConfig[] configs = config.createMatcheConfigs();
	UT2004DeathMatch[] matches = new UT2004DeathMatch[configs.length];
	for (int i = 0; i < configs.length; ++i) {
		matches[i] = new UT2004DeathMatch(configs[i], new LogCategory(configs[i].getMatchId().getToken()));
		matches[i].getLog().addHandler(new ILogPublisher() {

			@Override
			public void close() throws SecurityException {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void flush() {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void publish(LogRecord record) {
				if (UT2004DeathMatchTournament.this.log != null) {
					UT2004DeathMatchTournament.this.log.log(record);
				}
			}
			
		});			
	}
	executor = new UT2004MatchExecutor<UT2004DeathMatch, UT2004DeathMatchResult>(matches, log);
	executor.run();
}
 
Example 47
Project: incubator-netbeans   File: Actions.java   Source Code and License 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    LogRecord rec = new LogRecord(Level.FINER, "UI_ACTION_BUTTON_PRESS"); // NOI18N
    rec.setParameters(new Object[] { button, button.getClass().getName(), action, action.getClass().getName(), action.getValue(Action.NAME) });
    rec.setResourceBundle(NbBundle.getBundle(Actions.class));
    rec.setResourceBundleName(Actions.class.getPackage().getName() + ".Bundle"); // NOI18N
    rec.setLoggerName(UILOG.getName());
    UILOG.log(rec);
}
 
Example 48
Project: incubator-netbeans   File: TaskProcessorTest.java   Source Code and License 5 votes vote down vote up
public void testWarningWhenRunUserTaskCalledFromAWT() throws Exception {
    this.clearWorkDir();
    final File _wd = this.getWorkDir();
    final FileObject wd = FileUtil.toFileObject(_wd);

    FileUtil.setMIMEType("foo", "text/foo");
    final FileObject foo = wd.createData("file.foo");
    final LogRecord[] warning = new LogRecord[1];
    final String msgTemplate = "ParserManager.parse called in AWT event thread by: {0}";  //NOI18N

    MockMimeLookup.setInstances(MimePath.parse("text/foo"), new FooParserFactory());
    Logger.getLogger(TaskProcessor.class.getName()).addHandler(new Handler() {
        public @Override void publish(LogRecord record) {
            if (record.getMessage().startsWith(msgTemplate)) {
                warning[0] = record;
            }
        }

        public @Override void flush() {
        }

        public @Override void close() throws SecurityException {
        }
    });

    final StackTraceUserTask stackTraceUserTask = new StackTraceUserTask();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            try {
                ParserManager.parse(Collections.singleton(Source.create(foo)), stackTraceUserTask);
            } catch (ParseException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    });

    assertNotNull("No warning when calling ParserManager.parse from AWT", warning[0]);
    assertEquals("Wrong message", msgTemplate, warning[0].getMessage());
    assertEquals("Suspiciosly wrong warning message (is the caller identified correctly?)", stackTraceUserTask.caller, warning[0].getParameters()[0]);
}
 
Example 49
Project: openjdk-jdk10   File: TestLogHandler.java   Source Code and License 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    String msg = record.getMessage();
    String method = record.getSourceMethodName();
    String className = record.getSourceClassName();
    if (msg.contains(illegal)) {
        testFailed = true;
    }
    if (msg.contains("attribute names=")) {
        System.err.println("LOG: " + className + "." + method + ": " + msg);
    }
}
 
Example 50
Project: incubator-netbeans   File: InputGestureTest.java   Source Code and License 5 votes vote down vote up
public void testReadALogAndTestInputGestures() throws Exception {
    InputStream is = getClass().getResourceAsStream("NB1216449736.0");
    SortedMap<Integer,InputGesture> expectedGestures = new TreeMap<Integer,InputGesture>();
    expectedGestures.put(35, InputGesture.MENU);
    expectedGestures.put(59, InputGesture.KEYBOARD);
    expectedGestures.put(66, InputGesture.MENU);
    expectedGestures.put(80, InputGesture.MENU);
    expectedGestures.put(81, InputGesture.MENU);
    expectedGestures.put(177, InputGesture.KEYBOARD);
    expectedGestures.put(197, InputGesture.KEYBOARD);
    expectedGestures.put(205, InputGesture.MENU);
    TestHandler records = new TestHandler(is);
    for (int cnt = 0;; cnt++) {
        LOG.log(Level.INFO, "Reading {0}th record", cnt);
        LogRecord r = records.read();
        if (r == null) {
            break;
        }
        if (r.getSequenceNumber() > expectedGestures.lastKey()) {
            break;
        }
        LOG.log(Level.INFO, "Read {0}th record, seq {1}", new Object[] { cnt, r.getSequenceNumber() });

        InputGesture g = InputGesture.valueOf(r);
        InputGesture exp = expectedGestures.get((int)r.getSequenceNumber());
        assertEquals(cnt + ": For: " + r.getSequenceNumber() + " txt:\n`"+ r.getMessage() +
            "\nkey: " + r.getResourceBundleName()
            , exp, g);
    }
    is.close();
}
 
Example 51
Project: lazycat   File: VerbatimFormatter.java   Source Code and License 5 votes vote down vote up
@Override
public String format(LogRecord record) {
	// Timestamp
	StringBuilder sb = new StringBuilder(record.getMessage());

	// New line for next record
	sb.append(LINE_SEP);

	return sb.toString();
}
 
Example 52
Project: incubator-netbeans   File: Utils.java   Source Code and License 5 votes vote down vote up
/**
 * Logs a vcs client action usage.
 *
 * @param vcs - the particular vcs "SVN", "CVS", "CC", "HG", ...
 */
public static void logVCSActionEvent(String vcs) {
    String key = "USG_VCS_ACTION"  + vcs;
    if (checkMetricsKey(key)) return;
    LogRecord rec = new LogRecord(Level.INFO, "USG_VCS_ACTION");
    rec.setParameters(new Object[] { vcs });
    rec.setLoggerName(METRICS_LOG.getName());
    METRICS_LOG.log(rec);
}
 
Example 53
Project: incubator-netbeans   File: MessagesHandler.java   Source Code and License 5 votes vote down vote up
private LogRecord createRepeatingRecord(LogRecord r, long rc) {
    if (lastRecordAllRepeatsCounter <= (MAX_REPEAT_COUNT_FLUSH+1)) {
        return new LogRecord(r.getLevel(), getRepeatingMessage(rc, lastRecordAllRepeatsCounter));
    } else {
        return null;
    }
}
 
Example 54
Project: openjdk-jdk10   File: XMLFormatterDate.java   Source Code and License 5 votes vote down vote up
static void test(Supplier<TimeStamp> timeStampSupplier) {

        TimeStamp t1 = timeStampSupplier.get();
        int year1 = t1.getYear();

        LogRecord record = new LogRecord(Level.INFO, "test");
        XMLFormatter formatter = new XMLFormatter();
        final String formatted = formatter.format(record);
        System.out.println(formatted);

        final TimeStamp t2 = timeStampSupplier.get();
        final int year2 = t2.getYear();
        if (year2 < 1900) {
            throw new Error("Invalid system year: " + year2);
        }

        final StringBuilder buf2 = new StringBuilder()
                .append("<date>").append(year2).append("-");
        if (!formatted.contains(buf2.toString())) {
            StringBuilder buf1 = new StringBuilder()
                    .append("<date>").append(year1).append("-");
            if (formatted.contains(buf1) && year2 == year1 + 1
                    && t2.isJanuaryFirst()) {
                // Oh! The year just switched in the midst of the test...
                System.out.println("Happy new year!");
            } else {
                throw new Error("Expected year " + year2
                        + " not found in log:\n" + formatted);
            }
        }
    }
 
Example 55
Project: monarch   File: GfshInitFileJUnitTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testInitFile_TwoGoodCommands() throws Exception {
  File initFile = temporaryFolder_CurrentDirectory.newFile(INIT_FILE_NAME);
  FileUtils.writeStringToFile(initFile, "echo --string=hello" + Gfsh.LINE_SEPARATOR, APPEND);
  FileUtils.writeStringToFile(initFile, "echo --string=goodbye" + Gfsh.LINE_SEPARATOR, APPEND);

  /*
   * String historyFileName, String defaultPrompt, int historySize, String logDir, Level logLevel,
   * Integer logLimit, Integer logCount, String initFileName
   */
  GfshConfig gfshConfig = new GfshConfig(this.gfshHistoryFileName, "", 0,
      temporaryFolder_CurrentDirectory.getRoot().getAbsolutePath(), null, null, null,
      initFile.getAbsolutePath());
  assertNotNull(INIT_FILE_NAME, gfshConfig.getInitFileName());

  /*
   * boolean launchShell, String[] args, GfshConfig gfshConfig
   */
  Gfsh gfsh = Gfsh.getInstance(false, new String[] {}, gfshConfig);

  int actualStatus = gfsh.getLastExecutionStatus();
  int expectedStatus = 0;
  assertEquals("Status 0==success", expectedStatus, actualStatus);

  int expectedLogCount = BANNER_LINES + INIT_FILE_CITATION_LINES + 1;
  assertEquals("Log records written", expectedLogCount, this.junitLoggerHandler.getLog().size());
  for (LogRecord logRecord : this.junitLoggerHandler.getLog()) {
    assertNull("No exceptions in log", logRecord.getThrown());
  }
}
 
Example 56
Project: incubator-netbeans   File: Installer.java   Source Code and License 5 votes vote down vote up
private SubmitInteractive(String msg, boolean connectDialog, DataType dataType,
                          List<LogRecord> recs, SlownessData slownData,
                          boolean isAfterRestart) {
    super(msg, dataType, recs);
    this.connectDialog = connectDialog;
    this.slownData = slownData;
    this.isAfterRestart = isAfterRestart;
}
 
Example 57
Project: jdk8u-jdk   File: TestLogrbResourceBundle.java   Source Code and License 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    lastBundle = record.getResourceBundle();
    lastBundleName = record.getResourceBundleName();
    lastParams = record.getParameters();
    lastThrown = record.getThrown();
    lastMessage = record.getMessage();
}
 
Example 58
Project: incubator-netbeans   File: HistoryTest.java   Source Code and License 5 votes vote down vote up
@Override
public void publish (LogRecord record) {
    if (record.getMessage().contains("execEnv():")) {
        for (Object o : record.getParameters()) {
            if (o.toString().contains("hg") && o.toString().contains("log") && o.toString().contains(revision)) {
                ++called;
                break;
            }
        }
    } else if (record.getMessage().contains("persisting changePaths to disk cache")) {
        persisted = true;
    } else if (record.getMessage().contains("loading changePaths from disk cache")) {
        loadedFromCache = true;
    }
}
 
Example 59
Project: incubator-netbeans   File: Utils.java   Source Code and License 5 votes vote down vote up
/**
 * Logs a vcs external repository name.
 *
 * @param vcs - the particular vcs "SVN", "CVS", "CC", "HG", "GIT", ...
 * @param repositoryUrl - external repository url to log or null if the repository is local
 */
public static void logVCSExternalRepository (String vcs, String repositoryUrl) {
    String repositoryIdent = getKnownRepositoryFor(repositoryUrl);
    String key = "USG_VCS_REPOSITORY" + vcs + repositoryIdent; //NOI18N
    if (checkMetricsKey(key)) return;
    LogRecord rec = new LogRecord(Level.INFO, "USG_VCS_REPOSITORY"); //NOI18N
    rec.setParameters(new Object[] { vcs, repositoryIdent });
    rec.setLoggerName(METRICS_LOG.getName());
    METRICS_LOG.log(rec);
}
 
Example 60
Project: Pogamut3   File: LogFormatter.java   Source Code and License 5 votes vote down vote up
@Override
public synchronized String format(LogRecord record) {
	if (agentId != null && agentId.getName() != null) {
		this.name = this.agentId.getName().getFlag();
	}
	return super.format(record);
}