org.apache.log4j.Logger.debug()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(14.1k)|赞(0)|评价(0)|浏览(266)

本文整理了Java中org.apache.log4j.Logger.debug()方法的一些代码示例,展示了Logger.debug()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.debug()方法的具体详情如下:
包路径:org.apache.log4j.Logger
类名称:Logger
方法名:debug

Logger.debug介绍

[英]Log a message with the DEBUG level with message formatting done according to the value of messagePattern and arg parameters.

This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
[中]使用DEBUG级别记录消息,并根据messagePatternarg参数的值设置消息格式。
这种形式避免了超级参数构造。只要有可能,您应该使用此表单,而不是使用字符串连接构造消息参数。

代码示例

代码示例来源:origin: voldemort/voldemort

  1. public SelectorManagerWorker(Selector selector,
  2. SocketChannel socketChannel,
  3. int socketBufferSize) {
  4. this.selector = selector;
  5. this.socketChannel = socketChannel;
  6. this.socketBufferSize = socketBufferSize;
  7. this.resizeThreshold = socketBufferSize * 2; // This is arbitrary...
  8. this.createTimestamp = System.nanoTime();
  9. this.isClosed = new AtomicBoolean(false);
  10. if(logger.isDebugEnabled())
  11. logger.debug("Accepting remote connection from " + socketChannel.socket());
  12. }

代码示例来源:origin: voldemort/voldemort

  1. private Socket applySettings(Socket s) throws IOException {
  2. if(logger.isDebugEnabled())
  3. logger.debug("Attempting to set socket receive buffer of "
  4. + this.socketReceiveBufferSize + " bytes");
  5. s.setReceiveBufferSize(socketReceiveBufferSize);
  6. s.setSoTimeout(socketTimeout);
  7. if(logger.isDebugEnabled())
  8. logger.info("Actually set socket receive buffer to " + s.getReceiveBufferSize()
  9. + " bytes");
  10. return s;
  11. }

代码示例来源:origin: log4j/log4j

  1. /** Listens for client connections **/
  2. public void run() {
  3. LOG.info("Thread started");
  4. try {
  5. while (true) {
  6. LOG.debug("Waiting for a connection");
  7. final Socket client = mSvrSock.accept();
  8. LOG.debug("Got a connection from " +
  9. client.getInetAddress().getHostName());
  10. final Thread t = new Thread(new Slurper(client));
  11. t.setDaemon(true);
  12. t.start();
  13. }
  14. } catch (IOException e) {
  15. LOG.error("Error in accepting connections, stopping.", e);
  16. }
  17. }
  18. }

代码示例来源:origin: voldemort/voldemort

  1. public Versioned<V> getSysStore(K key) {
  2. logger.debug("Invoking Get for key : " + key + " on store name : " + this.storeName);
  3. Versioned<V> versioned = null;
  4. try {
  5. List<Versioned<V>> items = this.sysStore.get(key, null);
  6. if(items.size() == 1)
  7. versioned = items.get(0);
  8. else if(items.size() > 1)
  9. throw new InconsistentDataException("Unresolved versions returned from get(" + key
  10. + ") = " + items, items);
  11. if(versioned != null)
  12. logger.debug("Value for key : " + key + " = " + versioned.getValue()
  13. + " on store name : " + this.storeName);
  14. else
  15. logger.debug("Got null value");
  16. } catch(InvalidMetadataException e) {
  17. throw e;
  18. } catch(Exception e) {
  19. if(logger.isDebugEnabled()) {
  20. logger.debug("Exception caught during getSysStore: " + e);
  21. }
  22. }
  23. return versioned;
  24. }

代码示例来源:origin: marytts/marytts

  1. private double[][] getRealizedPitchScales(List<Phone> phones) {
  2. List<double[]> f0FactorList = new ArrayList<double[]>(phones.size());
  3. for (Phone phone : phones) {
  4. if (phone.getLeftTargetDuration() > 0) {
  5. int leftNumberOfFrames = phone.getNumberOfLeftUnitFrames();
  6. double[] leftF0Factors = phone.getLeftF0Factors();
  7. boolean clipped = MathUtils.clipRange(leftF0Factors, minPitchScaleFactor, maxPitchScaleFactor);
  8. if (clipped) {
  9. logger.debug("Left F0 factors for phone " + phone + " contained out-of-range values; clipped to ["
  10. + minPitchScaleFactor + ", " + maxPitchScaleFactor + "]");
  11. }
  12. f0FactorList.add(leftF0Factors);
  13. }
  14. if (phone.getRightTargetDuration() > 0) {
  15. int rightNumberOfFrames = phone.getNumberOfRightUnitFrames();
  16. double[] rightF0Factors = phone.getRightF0Factors();
  17. boolean clipped = MathUtils.clipRange(rightF0Factors, minPitchScaleFactor, maxPitchScaleFactor);
  18. if (clipped) {
  19. logger.debug("Left F0 factors for phone " + phone + " contained out-of-range values; clipped to ["
  20. + minPitchScaleFactor + ", " + maxPitchScaleFactor + "]");
  21. }
  22. f0FactorList.add(rightF0Factors);
  23. }
  24. }
  25. double[][] f0FactorArray = f0FactorList.toArray(new double[f0FactorList.size()][]);
  26. return f0FactorArray;
  27. }

代码示例来源:origin: apache/incubator-gobblin

  1. private List<Long> getValidationOutputFromHive(List<String> queries) throws IOException {
  2. if (null == queries || queries.size() == 0) {
  3. log.warn("No queries specified to be executed");
  4. return Collections.emptyList();
  5. Path hiveTempDir = new Path("/tmp" + Path.SEPARATOR + hiveOutput);
  6. query = "INSERT OVERWRITE DIRECTORY '" + hiveTempDir + "' " + query;
  7. log.info("Executing query: " + query);
  8. try {
  9. if (this.hiveSettings.size() > 0) {
  10. hiveJdbcConnector.executeStatements(this.hiveSettings.toArray(new String[this.hiveSettings.size()]));
  11. for (FileStatus fileStatus : fileStatusList) {
  12. if (fileStatus.isFile()) {
  13. files.add(fileStatus);
  14. log.debug("Deleting temp dir: " + hiveTempDir);
  15. this.fs.delete(hiveTempDir, true);

代码示例来源:origin: voldemort/voldemort

  1. private void commitToVoldemort(List<String> storeNamesToCommit) {
  2. if(logger.isDebugEnabled()) {
  3. logger.debug("Trying to commit to Voldemort");
  4. if(nodesToStream == null || nodesToStream.size() == 0) {
  5. if(logger.isDebugEnabled()) {
  6. logger.debug("No nodes to stream to. Returning.");
  7. logger.error("Exception during commit", e);
  8. hasError = true;
  9. if(!faultyNodes.contains(node.getId()))
  10. faultyNodes.add(node.getId());
  11. logger.warn("StreamingSession may not have been initialized since Variable streamingresults is null. Skipping callback ");
  12. return;
  13. logger.info("Invoking the Recovery Callback");
  14. Future future = streamingresults.submit(recoveryCallback);
  15. try {
  16. if(logger.isDebugEnabled()) {
  17. logger.debug("Commit successful");
  18. logger.debug("calling checkpoint callback");
  19. logger.warn("Checkpoint callback failed!", e1);
  20. } catch(ExecutionException e1) {
  21. logger.warn("Checkpoint callback failed during execution!", e1);

代码示例来源:origin: RipMeApp/ripme

  1. List<JSONObject> tweets = getTweets(getApiURL(lastMaxID - 1));
  2. if (tweets.isEmpty()) {
  3. LOGGER.info(" No more tweets found.");
  4. break;
  5. LOGGER.debug("Twitter response #" + (i + 1) + " Tweets:\n" + tweets);
  6. if (tweets.size() == 1 &&
  7. lastMaxID.equals(tweets.get(0).getString("id_str"))
  8. ) {
  9. LOGGER.info(" No more tweet found.");
  10. break;
  11. Thread.sleep(WAIT_TIME);
  12. } catch (InterruptedException e) {
  13. LOGGER.error("[!] Interrupted while waiting to load more results", e);
  14. break;

代码示例来源:origin: log4j/log4j

  1. final EventDetails event = (EventDetails) it.next();
  2. if (matchFilter(event)) {
  3. filtered.add(event);
  4. final int index = filtered.indexOf(lastFirst);
  5. if (index < 1) {
  6. LOG.warn("In strange state");
  7. fireTableDataChanged();
  8. } else {
  9. LOG.debug("Total time [ms]: " + (end - start)
  10. + " in update, size: " + size);

代码示例来源:origin: voldemort/voldemort

  1. /**
  2. * Persists the current set of versions buffered for the current key into
  3. * storage, using the multiVersionPut api
  4. *
  5. * NOTE: Now, it could be that the stream broke off and has more pending
  6. * versions. For now, we simply commit what we have to disk. A better design
  7. * would rely on in-stream markers to do the flushing to storage.
  8. */
  9. private void writeBufferedValsToStorage() {
  10. List<Versioned<byte[]>> obsoleteVals = storageEngine.multiVersionPut(currBufferedKey,
  11. currBufferedVals);
  12. // log Obsolete versions in debug mode
  13. if(logger.isDebugEnabled() && obsoleteVals.size() > 0) {
  14. logger.debug("updateEntries (Streaming multi-version-put) rejected these versions as obsolete : "
  15. + StoreUtils.getVersions(obsoleteVals) + " for key " + currBufferedKey);
  16. }
  17. currBufferedVals = new ArrayList<Versioned<byte[]>>(VALS_BUFFER_EXPECTED_SIZE);
  18. }

代码示例来源:origin: azkaban/azkaban

  1. /**
  2. * Add a metric to be managed by Metric Manager
  3. */
  4. public void addMetric(final IMetric<?> metric) {
  5. // metric null or already present
  6. if (metric == null) {
  7. throw new IllegalArgumentException("Cannot add a null metric");
  8. }
  9. if (getMetricFromName(metric.getName()) == null) {
  10. logger.debug(String.format("Adding %s metric in Metric Manager", metric.getName()));
  11. this.metrics.add(metric);
  12. metric.updateMetricManager(this);
  13. } else {
  14. logger.error("Failed to add metric");
  15. }
  16. }

代码示例来源:origin: marytts/marytts

  1. /**
  2. * Build the audio stream from the units
  3. *
  4. * @param units
  5. * the units
  6. * @return the resulting audio stream
  7. * @throws IOException
  8. * IOException
  9. */
  10. public AudioInputStream getAudio(List<SelectedUnit> units) throws IOException {
  11. logger.debug("Getting audio for " + units.size() + " units");
  12. // 1. Get the raw audio material for each unit from the timeline
  13. getDatagramsFromTimeline(units);
  14. // 2. Determine target pitchmarks (= duration and f0) for each unit
  15. determineTargetPitchmarks(units);
  16. // 2a. Analyze SelectedUnits wrt predicted vs. realized prosody
  17. try {
  18. prosodyAnalyzer = new ProsodyAnalyzer(units, timeline.getSampleRate());
  19. } catch (Exception e) {
  20. throw new IOException("Could not analyze prosody!", e);
  21. }
  22. // 3. Generate audio to match the target pitchmarks as closely as possible
  23. return generateAudioStream(units);
  24. }

代码示例来源:origin: voldemort/voldemort

  1. public void run() {
  2. logger.debug("************* AsyncMetadataVersionManger running. Checking for "
  3. + SystemStoreConstants.CLUSTER_VERSION_KEY + " and " + storesVersionKey
  4. + " *************");
  5. logger.info("Metadata version mismatch detected. Re-bootstrapping!");
  6. try {
  7. if(newClusterVersion != null) {
  8. logger.info("Updating cluster version");
  9. currentClusterVersion = newClusterVersion;
  10. logger.info("Updating store : '" + storesVersionKey + "' version");
  11. this.currentStoreVersion = newStoreVersion;
  12. logger.error("Exception occurred while invoking the rebootstrap callback.", e);
  13. this.storeClientThunk.call();
  14. } catch(Exception e2) {
  15. logger.error("Exception occurred while invoking the rebootstrap callback.", e);
  16. if(logger.isDebugEnabled()) {
  17. logger.debug("Could not retrieve metadata versions from the server.", e);

代码示例来源:origin: brianfrankcooper/YCSB

  1. @Override
  2. public Status delete(String table, String key) {
  3. if (LOGGER.isDebugEnabled()) {
  4. LOGGER.debug("deletekey: " + key + " from table: " + table);
  5. }
  6. DeleteItemRequest req = new DeleteItemRequest(table, createPrimaryKey(key));
  7. try {
  8. dynamoDB.deleteItem(req);
  9. } catch (AmazonServiceException ex) {
  10. LOGGER.error(ex);
  11. return Status.ERROR;
  12. } catch (AmazonClientException ex) {
  13. LOGGER.error(ex);
  14. return CLIENT_ERROR;
  15. }
  16. return Status.OK;
  17. }

代码示例来源:origin: voldemort/voldemort

  1. protected void closeInternal() {
  2. if(logger.isDebugEnabled())
  3. logger.debug("Closing remote connection from " + socketChannel.socket());
  4. try {
  5. socketChannel.socket().close();
  6. } catch(IOException e) {
  7. if(logger.isEnabledFor(Level.WARN))
  8. logger.warn(e.getMessage(), e);
  9. }
  10. try {
  11. socketChannel.close();
  12. } catch(IOException e) {
  13. if(logger.isEnabledFor(Level.WARN))
  14. logger.warn(e.getMessage(), e);
  15. }
  16. SelectionKey selectionKey = socketChannel.keyFor(selector);
  17. if(selectionKey != null) {
  18. try {
  19. selectionKey.attach(null);
  20. selectionKey.cancel();
  21. } catch(Exception e) {
  22. if(logger.isEnabledFor(Level.WARN))
  23. logger.warn(e.getMessage(), e);
  24. }
  25. }
  26. // close the streams, so we account for comm buffer frees
  27. IOUtils.closeQuietly(inputStream);
  28. IOUtils.closeQuietly(outputStream);
  29. }

代码示例来源:origin: log4j/log4j

  1. void registerAppenderMBean(Appender appender) {
  2. String name = getAppenderName(appender);
  3. cat.debug("Adding AppenderMBean for appender named "+name);
  4. ObjectName objectName = null;
  5. try {
  6. AppenderDynamicMBean appenderMBean = new AppenderDynamicMBean(appender);
  7. objectName = new ObjectName("log4j", "appender", name);
  8. if (!server.isRegistered(objectName)) {
  9. registerMBean(appenderMBean, objectName);
  10. dAttributes.add(new MBeanAttributeInfo("appender=" + name, "javax.management.ObjectName",
  11. "The " + name + " appender.", true, true, false));
  12. }
  13. } catch(JMException e) {
  14. cat.error("Could not add appenderMBean for ["+name+"].", e);
  15. } catch(java.beans.IntrospectionException e) {
  16. cat.error("Could not add appenderMBean for ["+name+"].", e);
  17. } catch(RuntimeException e) {
  18. cat.error("Could not add appenderMBean for ["+name+"].", e);
  19. }
  20. }

代码示例来源:origin: log4j/log4j

  1. /** loops getting the events **/
  2. public void run() {
  3. LOG.debug("Starting to get data");
  4. try {
  5. final ObjectInputStream ois =
  6. new ObjectInputStream(mClient.getInputStream());
  7. while (true) {
  8. final LoggingEvent event = (LoggingEvent) ois.readObject();
  9. mModel.addEvent(new EventDetails(event));
  10. }
  11. } catch (EOFException e) {
  12. LOG.info("Reached EOF, closing connection");
  13. } catch (SocketException e) {
  14. LOG.info("Caught SocketException, closing connection");
  15. } catch (IOException e) {
  16. LOG.warn("Got IOException, closing connection", e);
  17. } catch (ClassNotFoundException e) {
  18. LOG.warn("Got ClassNotFoundException, closing connection", e);
  19. }
  20. try {
  21. mClient.close();
  22. } catch (IOException e) {
  23. LOG.warn("Error closing connection", e);
  24. }
  25. }
  26. }

代码示例来源:origin: knightliao/disconf

  1. public void process(WatchedEvent event) {
  2. // lets either become the leader or watch the new/updated node
  3. LOG.debug("Watcher fired on path: " + event.getPath() + " state: " +
  4. event.getState() + " type " + event.getType());
  5. try {
  6. lock();
  7. } catch (Exception e) {
  8. LOG.warn("Failed to acquire lock: " + e, e);
  9. }
  10. }
  11. }

代码示例来源:origin: voldemort/voldemort

  1. @Override
  2. public void run() {
  3. try {
  4. BadKeyStatus badKeyStatus = badKeyQOut.take();
  5. while(!badKeyStatus.isPoison()) {
  6. logger.debug("BADKEY," + badKeyStatus.getBadKey().getKeyInHexFormat() + ","
  7. + badKeyStatus.getStatus().name() + "\n");
  8. fileWriter.write(badKeyStatus.getBadKey().getReaderInput());
  9. badKeyStatus = badKeyQOut.take();
  10. }
  11. } catch(IOException ioe) {
  12. logger.error("IO exception writing badKeyFile " + badKeyFileOut + " : "
  13. + ioe.getMessage());
  14. hasException = true;
  15. } catch(InterruptedException ie) {
  16. logger.error("Interrupted exception during writing of badKeyFile " + badKeyFileOut
  17. + " : " + ie.getMessage());
  18. hasException = true;
  19. } finally {
  20. try {
  21. fileWriter.close();
  22. } catch(IOException ioe) {
  23. logger.warn("Interrupted exception during fileWriter.close:" + ioe.getMessage());
  24. }
  25. }
  26. }

代码示例来源:origin: azkaban/azkaban

  1. /**
  2. * Ingest metric in snapshot data structure while maintaining interval {@inheritDoc}
  3. *
  4. * @see azkaban.metric.IMetricEmitter#reportMetric(azkaban.metric.IMetric)
  5. */
  6. @Override
  7. public void reportMetric(final IMetric<?> metric) throws MetricException {
  8. final String metricName = metric.getName();
  9. if (!this.historyListMapping.containsKey(metricName)) {
  10. logger.info("First time capturing metric: " + metricName);
  11. this.historyListMapping.put(metricName, new LinkedBlockingDeque<>());
  12. }
  13. synchronized (this.historyListMapping.get(metricName)) {
  14. logger.debug("Ingesting metric: " + metricName);
  15. this.historyListMapping.get(metricName).add(new InMemoryHistoryNode(metric.getValue()));
  16. cleanUsingTime(metricName, this.historyListMapping.get(metricName).peekLast().getTimestamp());
  17. }
  18. }

相关文章