List of usage examples for org.apache.commons.logging Log debug
void debug(Object message);
From source file:org.apache.nutch.util.ThreadPool.java
/** * Creates a pool of numThreads size./*from w w w. j a va 2 s .com*/ * These threads sit around waiting for jobs to * be posted to the list. */ public ThreadPool(int numThreads) { this.numThreads = numThreads; jobs = new Vector(37); running = true; for (int i = 0; i < numThreads; i++) { TaskThread t = new TaskThread(); t.start(); } Log l = LogFactory.getLog("org.apache.nutch.util"); if (l.isDebugEnabled()) { l.debug("ThreadPool created with " + numThreads + " threads."); } }
From source file:org.apache.nutch.util.ThreadPool.java
/** * Turn off the pool. Every thread, when finished with * its current work, will realize that the pool is no * longer running, and will exit.//from w w w. j a v a 2 s. c o m */ public void shutdown() { running = false; Log l = LogFactory.getLog("org.apache.nutch.util"); if (l.isDebugEnabled()) { l.debug("ThreadPool shutting down."); } }
From source file:org.apache.synapse.handler.util.HandlerUtil.java
/** * Helper util method to get the logging done whenever injecting the message into synapse * * @param log - Log appender to be used to append logs * @param messageContext - MessageContext which will be logged *//*from w ww. j a v a 2 s . c o m*/ public static void doHandlerLogging(Log log, MessageContext messageContext) { if (log.isDebugEnabled()) { log.debug("Synapse handler received a new message for message mediation..."); log.debug("Received To: " + (messageContext.getTo() != null ? messageContext.getTo().getAddress() : "null")); log.debug("SOAPAction: " + (messageContext.getSoapAction() != null ? messageContext.getSoapAction() : "null")); log.debug("WSA-Action: " + (messageContext.getWSAAction() != null ? messageContext.getWSAAction() : "null")); String[] cids = messageContext.getAttachmentMap().getAllContentIDs(); if (cids != null && cids.length > 0) { for (int i = 0; i < cids.length; i++) { log.debug("Attachment : " + cids[i]); } } log.debug("Body : \n" + messageContext.getEnvelope()); } }
From source file:org.apache.synapse.handler.util.HandlerUtil.java
public static boolean mediateInMessage(Log log, MessageContext messageContext, org.apache.synapse.MessageContext synCtx) throws AxisFault { AxisService service = messageContext.getAxisService(); if (service != null) { Parameter inMediationParam = service.getParameter(HandlerConstants.IN_SEQUENCE_PARAM_NAME); if (inMediationParam != null && inMediationParam.getValue() != null) { if (inMediationParam.getValue() instanceof Mediator) { Mediator inMessageSequence = (Mediator) inMediationParam.getValue(); return inMessageSequence.mediate(synCtx); } else if (inMediationParam.getValue() instanceof String) { Mediator inMessageSequence = synCtx.getConfiguration() .getSequence((String) inMediationParam.getValue()); return inMessageSequence.mediate(synCtx); } else { if (log.isDebugEnabled()) { log.debug("The provided in message mediation " + "sequence is not a proper mediator"); }//w ww. java 2s.c o m } } else { if (log.isDebugEnabled()) { log.debug("Couldn't find the incoming mediation for the service " + service.getName()); } } } else { String message = "Couldn't find the Service for the associated message with id " + messageContext.getMessageID(); log.error(message); throw new AxisFault(message); } return true; }
From source file:org.apache.synapse.handler.util.HandlerUtil.java
public static boolean mediateOutMessage(Log log, MessageContext messageContext, org.apache.synapse.MessageContext synCtx) throws AxisFault { AxisService service = messageContext.getAxisService(); if (service != null) { Parameter inMediationParam = service.getParameter(HandlerConstants.OUT_SEQUENCE_PARAM_NAME); if (inMediationParam != null && inMediationParam.getValue() != null) { if (inMediationParam.getValue() instanceof Mediator) { Mediator inMessageSequence = (Mediator) inMediationParam.getValue(); return inMessageSequence.mediate(synCtx); } else if (inMediationParam.getValue() instanceof String) { Mediator inMessageSequence = synCtx.getConfiguration() .getSequence((String) inMediationParam.getValue()); return inMessageSequence.mediate(synCtx); } else { if (log.isDebugEnabled()) { log.debug("The provided out message mediation " + "sequence is not a proper mediator"); }/*ww w . j a va 2 s . com*/ } } else { if (log.isDebugEnabled()) { log.debug("Couldn't find the outgoing mediation for the service " + service.getName()); } } } else { String message = "Couldn't find the Service for the associated message with id " + messageContext.getMessageID(); log.error(message); throw new AxisFault(message); } return true; }
From source file:org.apache.synapse.SynapseEngineConfigurator.java
public static void parse(SynapseEngine se, OMElement om) { Log log = LogFactory.getLog(SynapseEngineConfigurator.class); log.debug("parsing SynapseEngine " + om.toString()); List rulesets = new LinkedList(); RuleEngine[] inphase = null, outphase = null; Map ruleSetNames = new HashMap(); boolean inoutseparate = false; String inPhaseNames = null, outPhaseNames = null; if (!om.getLocalName().equals(Constants.SYNAPSE) || !om.getNamespace().getName().equals(Constants.SYNAPSE_NAMESPACE)) { throw new SynapseException("OMElement is not of namespace " + Constants.SYNAPSE_NAMESPACE + "or not localname " + Constants.SYNAPSE); }/* ww w .java 2s . c o m*/ OMNode node = om.getFirstOMChild(); while (node != null) { if (node.getType() != OMNode.ELEMENT_NODE) { node = node.getNextOMSibling(); continue; } // loop thru Elements only OMElement el = (OMElement) node; if (!el.getNamespace().getName().toLowerCase().equals(Constants.SYNAPSE_NAMESPACE)) { node = node.getNextOMSibling(); continue; } // ignore non-synapse elements if (el.getLocalName().toLowerCase().equals(Constants.STAGE)) { OMAttribute attr = el.getAttribute(Constants.RULE_TYPE_ATT_Q); if (attr == null) throw new SynapseException( "no " + Constants.RULE_TYPE_ATT_Q + " attribute on element " + el.toString()); String type = attr.getAttributeValue(); RuleEngine re = RuleEngineTypes.getRuleEngine(type); if (re != null) { re.init(el, se.getSynapseEnvironment().getClassLoader()); } rulesets.add(re); OMAttribute name = el.getAttribute(Constants.STAGE_NAME_ATT_Q); if (name != null) { ruleSetNames.put(name.getAttributeValue(), re); } } else if (el.getLocalName().toLowerCase().equals(Constants.IN)) { OMAttribute attr = el.getAttribute(Constants.IN_ORDER_ATTR_Q); if (attr != null) { inPhaseNames = attr.getAttributeValue(); } } else if (el.getLocalName().equals(Constants.OUT)) { OMAttribute attr = el.getAttribute(Constants.OUT_ORDER_ATTR_Q); if (attr != null) { outPhaseNames = attr.getAttributeValue(); } } node = node.getNextOMSibling(); } if (inPhaseNames != null || outPhaseNames != null) { inoutseparate = true; String inOrder[] = parsePhaseOrder(inPhaseNames); inphase = new RuleEngine[inOrder.length]; for (int i = 0; i < inOrder.length; i++) { RuleEngine r = (RuleEngine) ruleSetNames.get(inOrder[i]); if (r == null) { throw new SynapseException("missing ruleset specified in inPhase order: " + inOrder[i]); } else inphase[i] = r; } String outOrder[] = parsePhaseOrder(outPhaseNames); outphase = new RuleEngine[outOrder.length]; for (int i = 0; i < outOrder.length; i++) { RuleEngine r = (RuleEngine) ruleSetNames.get(outOrder[i]); if (r == null) { throw new SynapseException("missing ruleset specified in outPhase order: " + outOrder[i]); } else outphase[i] = r; } } else { inphase = new RuleEngine[rulesets.size()]; for (int i = 0; i < inphase.length; i++) { inphase[i] = (RuleEngine) rulesets.get(i); } } se.setInoutseparate(inoutseparate); se.setInphase(inphase); se.setOutphase(outphase); }
From source file:org.apache.sysml.parser.ParserWrapper.java
public static String readDMLScript(String script, Log LOG) throws IOException, LanguageException { String dmlScriptStr = null;//from w w w . j a v a2 s.c o m //read DML script from file if (script == null) throw new LanguageException("DML script path was not specified!"); StringBuilder sb = new StringBuilder(); BufferedReader in = null; try { //read from hdfs or gpfs file system if (script.startsWith("hdfs:") || script.startsWith("gpfs:") || IOUtilFunctions.isObjectStoreFileScheme(new Path(script))) { Path scriptPath = new Path(script); String scheme = (scriptPath.toUri() != null) ? scriptPath.toUri().getScheme() : null; LOG.debug("Looking for the following file in " + scheme + ": " + script); FileSystem fs = IOUtilFunctions.getFileSystem(scriptPath); in = new BufferedReader(new InputStreamReader(fs.open(scriptPath))); } // from local file system else { LOG.debug("Looking for the following file in the local file system: " + script); if (Files.exists(Paths.get(script))) in = new BufferedReader(new FileReader(script)); else // check in scripts/ directory for file (useful for tests) in = new BufferedReader(new FileReader("scripts/" + script)); } //core script reading String tmp = null; while ((tmp = in.readLine()) != null) { sb.append(tmp); sb.append("\n"); } } catch (IOException ex) { String resPath = scriptPathToResourcePath(script); LOG.debug("Looking for the following resource from the SystemML jar file: " + resPath); InputStream is = null; try { is = ParserWrapper.class.getResourceAsStream(resPath); if (is == null) { if (resPath.startsWith("/scripts")) { LOG.error("Failed to read from the file system ('" + script + "') or SystemML jar file ('" + resPath + "')"); throw ex; } else { // for accessing script packages in the scripts directory String scriptsResPath = "/scripts" + resPath; LOG.debug( "Looking for the following resource from the SystemML jar file: " + scriptsResPath); is = ParserWrapper.class.getResourceAsStream(scriptsResPath); if (is == null) { LOG.error("Failed to read from the file system ('" + script + "') or SystemML jar file ('" + resPath + "' or '" + scriptsResPath + "')"); throw ex; } } } String s = IOUtils.toString(is); return s; } finally { IOUtilFunctions.closeSilently(is); } } finally { IOUtilFunctions.closeSilently(in); } dmlScriptStr = sb.toString(); return dmlScriptStr; }
From source file:org.apache.sysml.runtime.controlprogram.parfor.RemoteParForUtils.java
public static LocalVariableMap[] getResults(List<Tuple2<Long, String>> out, Log LOG) throws DMLRuntimeException { HashMap<Long, LocalVariableMap> tmp = new HashMap<Long, LocalVariableMap>(); int countAll = 0; for (Tuple2<Long, String> entry : out) { Long key = entry._1();/*from w w w . ja v a 2 s . c om*/ String val = entry._2(); if (!tmp.containsKey(key)) tmp.put(key, new LocalVariableMap()); Object[] dat = ProgramConverter.parseDataObject(val); tmp.get(key).put((String) dat[0], (Data) dat[1]); countAll++; } if (LOG != null) { LOG.debug("Num remote worker results (before deduplication): " + countAll); LOG.debug("Num remote worker results: " + tmp.size()); } //create return array return tmp.values().toArray(new LocalVariableMap[0]); }
From source file:org.apache.tajo.engine.planner.physical.PhysicalExec.java
protected void debug(Log log, String message) { log.debug("[" + context.getTaskId() + "] " + message); }
From source file:org.apache.tez.common.impl.LogUtils.java
public static void logCredentials(Log log, Credentials credentials, String identifier) { if (log.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); sb.append("#" + identifier + "Tokens=").append(credentials.numberOfTokens()); if (credentials.numberOfTokens() > 0) { sb.append(", Services: "); for (Token<?> t : credentials.getAllTokens()) { sb.append(t.getService()).append(","); }//from w w w . j a va 2 s .c o m } log.debug(sb.toString()); } }