本文整理了Java中org.apache.log4j.Logger.debug()
方法的一些代码示例,展示了Logger.debug()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.debug()
方法的具体详情如下:
包路径:org.apache.log4j.Logger
类名称: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
级别记录消息,并根据messagePattern
和arg
参数的值设置消息格式。
这种形式避免了超级参数构造。只要有可能,您应该使用此表单,而不是使用字符串连接构造消息参数。
代码示例来源:origin: voldemort/voldemort
public SelectorManagerWorker(Selector selector,
SocketChannel socketChannel,
int socketBufferSize) {
this.selector = selector;
this.socketChannel = socketChannel;
this.socketBufferSize = socketBufferSize;
this.resizeThreshold = socketBufferSize * 2; // This is arbitrary...
this.createTimestamp = System.nanoTime();
this.isClosed = new AtomicBoolean(false);
if(logger.isDebugEnabled())
logger.debug("Accepting remote connection from " + socketChannel.socket());
}
代码示例来源:origin: voldemort/voldemort
private Socket applySettings(Socket s) throws IOException {
if(logger.isDebugEnabled())
logger.debug("Attempting to set socket receive buffer of "
+ this.socketReceiveBufferSize + " bytes");
s.setReceiveBufferSize(socketReceiveBufferSize);
s.setSoTimeout(socketTimeout);
if(logger.isDebugEnabled())
logger.info("Actually set socket receive buffer to " + s.getReceiveBufferSize()
+ " bytes");
return s;
}
代码示例来源:origin: log4j/log4j
/** Listens for client connections **/
public void run() {
LOG.info("Thread started");
try {
while (true) {
LOG.debug("Waiting for a connection");
final Socket client = mSvrSock.accept();
LOG.debug("Got a connection from " +
client.getInetAddress().getHostName());
final Thread t = new Thread(new Slurper(client));
t.setDaemon(true);
t.start();
}
} catch (IOException e) {
LOG.error("Error in accepting connections, stopping.", e);
}
}
}
代码示例来源:origin: voldemort/voldemort
public Versioned<V> getSysStore(K key) {
logger.debug("Invoking Get for key : " + key + " on store name : " + this.storeName);
Versioned<V> versioned = null;
try {
List<Versioned<V>> items = this.sysStore.get(key, null);
if(items.size() == 1)
versioned = items.get(0);
else if(items.size() > 1)
throw new InconsistentDataException("Unresolved versions returned from get(" + key
+ ") = " + items, items);
if(versioned != null)
logger.debug("Value for key : " + key + " = " + versioned.getValue()
+ " on store name : " + this.storeName);
else
logger.debug("Got null value");
} catch(InvalidMetadataException e) {
throw e;
} catch(Exception e) {
if(logger.isDebugEnabled()) {
logger.debug("Exception caught during getSysStore: " + e);
}
}
return versioned;
}
代码示例来源:origin: marytts/marytts
private double[][] getRealizedPitchScales(List<Phone> phones) {
List<double[]> f0FactorList = new ArrayList<double[]>(phones.size());
for (Phone phone : phones) {
if (phone.getLeftTargetDuration() > 0) {
int leftNumberOfFrames = phone.getNumberOfLeftUnitFrames();
double[] leftF0Factors = phone.getLeftF0Factors();
boolean clipped = MathUtils.clipRange(leftF0Factors, minPitchScaleFactor, maxPitchScaleFactor);
if (clipped) {
logger.debug("Left F0 factors for phone " + phone + " contained out-of-range values; clipped to ["
+ minPitchScaleFactor + ", " + maxPitchScaleFactor + "]");
}
f0FactorList.add(leftF0Factors);
}
if (phone.getRightTargetDuration() > 0) {
int rightNumberOfFrames = phone.getNumberOfRightUnitFrames();
double[] rightF0Factors = phone.getRightF0Factors();
boolean clipped = MathUtils.clipRange(rightF0Factors, minPitchScaleFactor, maxPitchScaleFactor);
if (clipped) {
logger.debug("Left F0 factors for phone " + phone + " contained out-of-range values; clipped to ["
+ minPitchScaleFactor + ", " + maxPitchScaleFactor + "]");
}
f0FactorList.add(rightF0Factors);
}
}
double[][] f0FactorArray = f0FactorList.toArray(new double[f0FactorList.size()][]);
return f0FactorArray;
}
代码示例来源:origin: apache/incubator-gobblin
private List<Long> getValidationOutputFromHive(List<String> queries) throws IOException {
if (null == queries || queries.size() == 0) {
log.warn("No queries specified to be executed");
return Collections.emptyList();
Path hiveTempDir = new Path("/tmp" + Path.SEPARATOR + hiveOutput);
query = "INSERT OVERWRITE DIRECTORY '" + hiveTempDir + "' " + query;
log.info("Executing query: " + query);
try {
if (this.hiveSettings.size() > 0) {
hiveJdbcConnector.executeStatements(this.hiveSettings.toArray(new String[this.hiveSettings.size()]));
for (FileStatus fileStatus : fileStatusList) {
if (fileStatus.isFile()) {
files.add(fileStatus);
log.debug("Deleting temp dir: " + hiveTempDir);
this.fs.delete(hiveTempDir, true);
代码示例来源:origin: voldemort/voldemort
private void commitToVoldemort(List<String> storeNamesToCommit) {
if(logger.isDebugEnabled()) {
logger.debug("Trying to commit to Voldemort");
if(nodesToStream == null || nodesToStream.size() == 0) {
if(logger.isDebugEnabled()) {
logger.debug("No nodes to stream to. Returning.");
logger.error("Exception during commit", e);
hasError = true;
if(!faultyNodes.contains(node.getId()))
faultyNodes.add(node.getId());
logger.warn("StreamingSession may not have been initialized since Variable streamingresults is null. Skipping callback ");
return;
logger.info("Invoking the Recovery Callback");
Future future = streamingresults.submit(recoveryCallback);
try {
if(logger.isDebugEnabled()) {
logger.debug("Commit successful");
logger.debug("calling checkpoint callback");
logger.warn("Checkpoint callback failed!", e1);
} catch(ExecutionException e1) {
logger.warn("Checkpoint callback failed during execution!", e1);
代码示例来源:origin: RipMeApp/ripme
List<JSONObject> tweets = getTweets(getApiURL(lastMaxID - 1));
if (tweets.isEmpty()) {
LOGGER.info(" No more tweets found.");
break;
LOGGER.debug("Twitter response #" + (i + 1) + " Tweets:\n" + tweets);
if (tweets.size() == 1 &&
lastMaxID.equals(tweets.get(0).getString("id_str"))
) {
LOGGER.info(" No more tweet found.");
break;
Thread.sleep(WAIT_TIME);
} catch (InterruptedException e) {
LOGGER.error("[!] Interrupted while waiting to load more results", e);
break;
代码示例来源:origin: log4j/log4j
final EventDetails event = (EventDetails) it.next();
if (matchFilter(event)) {
filtered.add(event);
final int index = filtered.indexOf(lastFirst);
if (index < 1) {
LOG.warn("In strange state");
fireTableDataChanged();
} else {
LOG.debug("Total time [ms]: " + (end - start)
+ " in update, size: " + size);
代码示例来源:origin: voldemort/voldemort
/**
* Persists the current set of versions buffered for the current key into
* storage, using the multiVersionPut api
*
* NOTE: Now, it could be that the stream broke off and has more pending
* versions. For now, we simply commit what we have to disk. A better design
* would rely on in-stream markers to do the flushing to storage.
*/
private void writeBufferedValsToStorage() {
List<Versioned<byte[]>> obsoleteVals = storageEngine.multiVersionPut(currBufferedKey,
currBufferedVals);
// log Obsolete versions in debug mode
if(logger.isDebugEnabled() && obsoleteVals.size() > 0) {
logger.debug("updateEntries (Streaming multi-version-put) rejected these versions as obsolete : "
+ StoreUtils.getVersions(obsoleteVals) + " for key " + currBufferedKey);
}
currBufferedVals = new ArrayList<Versioned<byte[]>>(VALS_BUFFER_EXPECTED_SIZE);
}
代码示例来源:origin: azkaban/azkaban
/**
* Add a metric to be managed by Metric Manager
*/
public void addMetric(final IMetric<?> metric) {
// metric null or already present
if (metric == null) {
throw new IllegalArgumentException("Cannot add a null metric");
}
if (getMetricFromName(metric.getName()) == null) {
logger.debug(String.format("Adding %s metric in Metric Manager", metric.getName()));
this.metrics.add(metric);
metric.updateMetricManager(this);
} else {
logger.error("Failed to add metric");
}
}
代码示例来源:origin: marytts/marytts
/**
* Build the audio stream from the units
*
* @param units
* the units
* @return the resulting audio stream
* @throws IOException
* IOException
*/
public AudioInputStream getAudio(List<SelectedUnit> units) throws IOException {
logger.debug("Getting audio for " + units.size() + " units");
// 1. Get the raw audio material for each unit from the timeline
getDatagramsFromTimeline(units);
// 2. Determine target pitchmarks (= duration and f0) for each unit
determineTargetPitchmarks(units);
// 2a. Analyze SelectedUnits wrt predicted vs. realized prosody
try {
prosodyAnalyzer = new ProsodyAnalyzer(units, timeline.getSampleRate());
} catch (Exception e) {
throw new IOException("Could not analyze prosody!", e);
}
// 3. Generate audio to match the target pitchmarks as closely as possible
return generateAudioStream(units);
}
代码示例来源:origin: voldemort/voldemort
public void run() {
logger.debug("************* AsyncMetadataVersionManger running. Checking for "
+ SystemStoreConstants.CLUSTER_VERSION_KEY + " and " + storesVersionKey
+ " *************");
logger.info("Metadata version mismatch detected. Re-bootstrapping!");
try {
if(newClusterVersion != null) {
logger.info("Updating cluster version");
currentClusterVersion = newClusterVersion;
logger.info("Updating store : '" + storesVersionKey + "' version");
this.currentStoreVersion = newStoreVersion;
logger.error("Exception occurred while invoking the rebootstrap callback.", e);
this.storeClientThunk.call();
} catch(Exception e2) {
logger.error("Exception occurred while invoking the rebootstrap callback.", e);
if(logger.isDebugEnabled()) {
logger.debug("Could not retrieve metadata versions from the server.", e);
代码示例来源:origin: brianfrankcooper/YCSB
@Override
public Status delete(String table, String key) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("deletekey: " + key + " from table: " + table);
}
DeleteItemRequest req = new DeleteItemRequest(table, createPrimaryKey(key));
try {
dynamoDB.deleteItem(req);
} catch (AmazonServiceException ex) {
LOGGER.error(ex);
return Status.ERROR;
} catch (AmazonClientException ex) {
LOGGER.error(ex);
return CLIENT_ERROR;
}
return Status.OK;
}
代码示例来源:origin: voldemort/voldemort
protected void closeInternal() {
if(logger.isDebugEnabled())
logger.debug("Closing remote connection from " + socketChannel.socket());
try {
socketChannel.socket().close();
} catch(IOException e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
try {
socketChannel.close();
} catch(IOException e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
SelectionKey selectionKey = socketChannel.keyFor(selector);
if(selectionKey != null) {
try {
selectionKey.attach(null);
selectionKey.cancel();
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
}
// close the streams, so we account for comm buffer frees
IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
}
代码示例来源:origin: log4j/log4j
void registerAppenderMBean(Appender appender) {
String name = getAppenderName(appender);
cat.debug("Adding AppenderMBean for appender named "+name);
ObjectName objectName = null;
try {
AppenderDynamicMBean appenderMBean = new AppenderDynamicMBean(appender);
objectName = new ObjectName("log4j", "appender", name);
if (!server.isRegistered(objectName)) {
registerMBean(appenderMBean, objectName);
dAttributes.add(new MBeanAttributeInfo("appender=" + name, "javax.management.ObjectName",
"The " + name + " appender.", true, true, false));
}
} catch(JMException e) {
cat.error("Could not add appenderMBean for ["+name+"].", e);
} catch(java.beans.IntrospectionException e) {
cat.error("Could not add appenderMBean for ["+name+"].", e);
} catch(RuntimeException e) {
cat.error("Could not add appenderMBean for ["+name+"].", e);
}
}
代码示例来源:origin: log4j/log4j
/** loops getting the events **/
public void run() {
LOG.debug("Starting to get data");
try {
final ObjectInputStream ois =
new ObjectInputStream(mClient.getInputStream());
while (true) {
final LoggingEvent event = (LoggingEvent) ois.readObject();
mModel.addEvent(new EventDetails(event));
}
} catch (EOFException e) {
LOG.info("Reached EOF, closing connection");
} catch (SocketException e) {
LOG.info("Caught SocketException, closing connection");
} catch (IOException e) {
LOG.warn("Got IOException, closing connection", e);
} catch (ClassNotFoundException e) {
LOG.warn("Got ClassNotFoundException, closing connection", e);
}
try {
mClient.close();
} catch (IOException e) {
LOG.warn("Error closing connection", e);
}
}
}
代码示例来源:origin: knightliao/disconf
public void process(WatchedEvent event) {
// lets either become the leader or watch the new/updated node
LOG.debug("Watcher fired on path: " + event.getPath() + " state: " +
event.getState() + " type " + event.getType());
try {
lock();
} catch (Exception e) {
LOG.warn("Failed to acquire lock: " + e, e);
}
}
}
代码示例来源:origin: voldemort/voldemort
@Override
public void run() {
try {
BadKeyStatus badKeyStatus = badKeyQOut.take();
while(!badKeyStatus.isPoison()) {
logger.debug("BADKEY," + badKeyStatus.getBadKey().getKeyInHexFormat() + ","
+ badKeyStatus.getStatus().name() + "\n");
fileWriter.write(badKeyStatus.getBadKey().getReaderInput());
badKeyStatus = badKeyQOut.take();
}
} catch(IOException ioe) {
logger.error("IO exception writing badKeyFile " + badKeyFileOut + " : "
+ ioe.getMessage());
hasException = true;
} catch(InterruptedException ie) {
logger.error("Interrupted exception during writing of badKeyFile " + badKeyFileOut
+ " : " + ie.getMessage());
hasException = true;
} finally {
try {
fileWriter.close();
} catch(IOException ioe) {
logger.warn("Interrupted exception during fileWriter.close:" + ioe.getMessage());
}
}
}
代码示例来源:origin: azkaban/azkaban
/**
* Ingest metric in snapshot data structure while maintaining interval {@inheritDoc}
*
* @see azkaban.metric.IMetricEmitter#reportMetric(azkaban.metric.IMetric)
*/
@Override
public void reportMetric(final IMetric<?> metric) throws MetricException {
final String metricName = metric.getName();
if (!this.historyListMapping.containsKey(metricName)) {
logger.info("First time capturing metric: " + metricName);
this.historyListMapping.put(metricName, new LinkedBlockingDeque<>());
}
synchronized (this.historyListMapping.get(metricName)) {
logger.debug("Ingesting metric: " + metricName);
this.historyListMapping.get(metricName).add(new InMemoryHistoryNode(metric.getValue()));
cleanUsingTime(metricName, this.historyListMapping.get(metricName).peekLast().getTimestamp());
}
}
内容来源于网络,如有侵权,请联系作者删除!