List of usage examples for org.apache.commons.logging Log isDebugEnabled
boolean isDebugEnabled();
From source file:org.apache.synapse.transport.nhttp.LoggingUtils.java
public static NHttpClientIOTarget decorate(NHttpClientIOTarget target) { Log log = LogFactory.getLog(target.getClass()); Log headerlog = LogFactory.getLog(HEADER_LOG_ID); if (log.isDebugEnabled() || headerlog.isDebugEnabled()) { target = new LoggingNHttpClientIOTarget(log, headerlog, target); }//from w w w. j av a2 s .c om return target; }
From source file:org.apache.synapse.transport.nhttp.LoggingUtils.java
public static NHttpServerIOTarget decorate(NHttpServerIOTarget target) { Log log = LogFactory.getLog(target.getClass()); Log headerlog = LogFactory.getLog(HEADER_LOG_ID); if (log.isDebugEnabled() || headerlog.isDebugEnabled()) { target = new LoggingNHttpServerIOTarget(log, headerlog, target); }/* w ww.java2s . c om*/ return target; }
From source file:org.apache.synapse.transport.nhttp.LoggingUtils.java
public static NHttpClientHandler decorate(NHttpClientHandler handler) { Log log = LogFactory.getLog(handler.getClass()); Log headerlog = LogFactory.getLog(HEADER_LOG_ID); if (log.isDebugEnabled() || headerlog.isDebugEnabled()) { handler = new LoggingNHttpClientHandler(log, headerlog, handler); }/* w w w.j av a 2 s .co m*/ return handler; }
From source file:org.apache.synapse.transport.nhttp.LoggingUtils.java
public static NHttpServiceHandler decorate(NHttpServiceHandler handler) { Log log = LogFactory.getLog(handler.getClass()); Log headerlog = LogFactory.getLog(HEADER_LOG_ID); if (log.isDebugEnabled() || headerlog.isDebugEnabled()) { handler = new LoggingNHttpServiceHandler(log, headerlog, handler); }//from w ww .j a v a 2 s. c o m return handler; }
From source file:org.apache.synapse.transport.utils.logging.LoggingUtils.java
private static NHttpClientEventHandler decorate(NHttpClientEventHandler handler) { Log log = LogFactory.getLog(handler.getClass()); if (log.isDebugEnabled()) { handler = new LoggingClientEventHandler(handler); }//from ww w .j a va2s . c o m return handler; }
From source file:org.apache.synapse.transport.utils.logging.LoggingUtils.java
private static NHttpServerEventHandler decorate(NHttpServerEventHandler handler) { Log log = LogFactory.getLog(handler.getClass()); if (log.isDebugEnabled()) { handler = new LoggingServerEventHandler(handler); }/*w ww . ja v a 2 s.co m*/ return handler; }
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 ww w.j av a2 s . c o m } log.debug(sb.toString()); } }
From source file:org.broadleafcommerce.core.order.service.OrderServiceImpl.java
@Override public void printOrder(Order order, Log log) { if (!log.isDebugEnabled()) { return;/*from w w w . j a v a2 s.c o m*/ } TableCreator tc = new TableCreator(new TableCreator.Col[] { new TableCreator.Col("Order Item", 30), new TableCreator.Col("Qty"), new TableCreator.Col("Unit Price"), new TableCreator.Col("Avg Adj"), new TableCreator.Col("Total Adj"), new TableCreator.Col("Total Price") }); for (OrderItem oi : order.getOrderItems()) { tc.addRow(new String[] { oi.getName(), String.valueOf(oi.getQuantity()), String.valueOf(oi.getPriceBeforeAdjustments(true)), String.valueOf(oi.getAverageAdjustmentValue()), String.valueOf(oi.getTotalAdjustmentValue()), String.valueOf(oi.getTotalPrice()) }); } tc.addSeparator().withGlobalRowHeaderWidth(15).addRow("Subtotal", order.getSubTotal()) .addRow("Order Adj.", order.getOrderAdjustmentsValue()).addRow("Tax", order.getTotalTax()) .addRow("Shipping", order.getTotalShipping()).addRow("Total", order.getTotal()).addSeparator(); log.debug(tc.toString()); }
From source file:org.castor.jaxb.CastorJAXBUtils.java
/** * Logs the message with debug level, this method performs checking if debug level is enabled before logging the * message.//from ww w .j a v a 2 s . c o m * * @param log the log to use * @param msg the log message */ public static void logDebug(Log log, String msg) { if (log.isDebugEnabled()) { log.debug(msg); } }
From source file:org.danann.cernunnos.runtime.Main.java
public static void main(String[] args) { Log log = LogFactory.getLog(ScriptRunner.class); // Put some whitespace between the command and the output... System.out.println(""); // Register custom protocol handlers... try {/*from w w w . j a v a 2s .c o m*/ URL.setURLStreamHandlerFactory(new URLStreamHandlerFactoryImpl()); } catch (Throwable t) { log.warn("Cernunnos was unable to register a URLStreamHandlerFactory. " + "Custom URL protocols may not work properly (e.g. classpath://, c:/). " + "See stack trace below.", t); } // Establish CRN_HOME... String crnHome = System.getenv("CRN_HOME"); if (crnHome == null) { if (log.isDebugEnabled()) { log.debug("The CRN_HOME environment variable is not defined; " + "this is completely normal for embedded applications " + "of Cernunnos."); } } // Look at the specified script: might it be in the bin/ directory? String location = args[0]; try { // This is how ScriptRunner will attempt to locate the script file... URL u = new URL(new File(".").toURI().toURL(), location); if (u.getProtocol().equals("file")) { // We know the specified resource is a local file; is it either // (1) absolute or (2) relative to the directory where Java is // executing? if (!new File(u.toURI()).exists() && crnHome != null) { // No. And what's more, 'CRN_HOME' is defined. In this case // let's see if the specified script *is* present in the bin/ // directory. StringBuilder path = new StringBuilder(); path.append(crnHome).append(File.separator).append("bin").append(File.separator) .append(location); File f = new File(path.toString()); if (f.exists()) { // The user is specifying a Cernunnos script in the bin/ directory... location = f.toURI().toURL().toExternalForm(); if (log.isInfoEnabled()) { log.info("Resolving the specified Cernunnos document " + "to a file in the CRN_HOME/bin directory: " + location); } } } } } catch (Throwable t) { // Just let this pass -- genuine issues will be caught & reported shortly... } // Analyze the command-line arguments... RuntimeRequestResponse req = new RuntimeRequestResponse(); switch (args.length) { case 0: // No file provided, can't continue... System.out.println("Usage:\n\n\t>crn [script_name] [arguments]"); System.exit(0); break; default: for (int i = 1; i < args.length; i++) { req.setAttribute("$" + i, args[i]); } break; } ScriptRunner runner = new ScriptRunner(); runner.run(location, req); }