private void configure() { bufferSize = manager.getProperty(LogConstants.BUFFER_SIZE); if (bufferSize != null && bufferSize.length() > 0) { try { recCountLimit = Integer.parseInt(bufferSize); } catch (NumberFormatException e) { recCountLimit = 1; } } else { recCountLimit = 1; } String status = manager.getProperty(LogConstants.TIME_BUFFERING_STATUS); if (status != null && status.equalsIgnoreCase("ON")) { timeBufferingEnabled = true; } setLevel(Level.ALL); setFilter(null); String urlString = manager.getProperty(LogConstants.LOGGING_SERVICE_URL); try { logServURL = new URL(urlString); } catch (MalformedURLException mue) { if (Debug.warningEnabled()) { Debug.warning( "RemoteHandler.getLogHostURL(): '" + urlString + "' is malformed. " + mue.getMessage()); } } }
/** * This method sends the LogRecord to the remote logging service. * * @param logRecord The LogRecord to be published to the remote logging service. */ public synchronized void publish(java.util.logging.LogRecord logRecord) { logName = logRecord.getLoggerName(); String xml = getFormatter().format(logRecord); if (xml == null || xml.length() <= 0) { if (Debug.warningEnabled()) { Debug.warning(logName + ":RemoteHandler.publish : formatted xml is null"); } return; } Request request = new Request(xml); if (logRecord instanceof ILogRecord) { Map logInfoMap = ((ILogRecord) logRecord).getLogInfoMap(); String loggedBySid = (String) logInfoMap.get(LogConstants.LOGGED_BY_SID); if (loggedBySid != null) { RequestSet reqSet = (RequestSet) reqSetMap.get(loggedBySid); if (reqSet == null) { reqSet = new RequestSet("Logging"); } reqSet.addRequest(request); reqSetMap.put(loggedBySid, reqSet); } } this.recCount++; if (this.recCount >= recCountLimit) { if (Debug.messageEnabled()) { Debug.message( logName + ":RemoteHandler.publish(): got " + recCount + " records, flushing all"); } nonBlockingFlush(); } }