List of usage examples for org.apache.commons.logging Log info
void info(Object message);
From source file:org.aslab.tests.nodeslistener.NodeListener.java
@Override public void onStart(ConnectedNode connectedNode) { final Log log = connectedNode.getLog(); Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE); subscriber.addMessageListener(new MessageListener<std_msgs.String>() { @Override/*from w w w.j a v a 2 s . co m*/ public void onNewMessage(std_msgs.String message) { log.info("I heard: \"" + message.getData() + "\""); } }); Subscriber<meta_msgs.NodesInfoList> subscriber2 = connectedNode.newSubscriber("node_list", meta_msgs.NodesInfoList._TYPE); subscriber2.addMessageListener(new MessageListener<meta_msgs.NodesInfoList>() { @Override public void onNewMessage(meta_msgs.NodesInfoList message) { log.info("I heard: \"" + "algo" + "\""); } }); }
From source file:org.atomserver.AtomServer.java
private void log500Error(Throwable e, Abdera abdera, RequestContext request) { if (errlog != null) { Log http500log = errlog.getLog(); if (http500log.isInfoEnabled()) { try { http500log.info( "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); http500log.info("==> 500 ERROR occurred for {" + request.getUri() + "} Type:: " + e.getClass().getName() + " Reason:: " + e.getMessage()); http500log.error("500 Error:: ", e); http500log.info("METHOD:: " + request.getMethod()); if (request.getPrincipal() != null) { http500log.info("PRINCIPAL:: " + request.getPrincipal().getName()); }// w w w . jav a2 s . c om http500log.info("HEADERS:: "); String[] headerNames = request.getHeaderNames(); if (headerNames != null) { for (int ii = 0; ii < headerNames.length; ii++) { http500log .info("Header(" + headerNames[ii] + ")= " + request.getHeader(headerNames[ii])); } } http500log.info("PARAMETERS:: "); String[] paramNames = request.getParameterNames(); if (paramNames != null) { for (int ii = 0; ii < paramNames.length; ii++) { http500log.info( "Parameter(" + paramNames[ii] + ")= " + request.getParameter(paramNames[ii])); } } if (request instanceof HttpServletRequestContext) { HttpServletRequestContext httpRequest = (HttpServletRequestContext) request; javax.servlet.http.HttpServletRequest servletRequest = httpRequest.getRequest(); if (servletRequest != null) { http500log.info("QUERY STRING::" + servletRequest.getQueryString()); http500log.info("AUTH TYPE:: " + servletRequest.getAuthType()); http500log.info("REMOTE USER:: " + servletRequest.getRemoteUser()); http500log.info("REMOTE ADDR:: " + servletRequest.getRemoteAddr()); http500log.info("REMOTE HOST:: " + servletRequest.getRemoteHost()); } } http500log.info("BODY:: "); if (request.getDocument() != null) { java.io.StringWriter stringWriter = new java.io.StringWriter(); request.getDocument().writeTo(abdera.getWriterFactory().getWriter("PrettyXML"), stringWriter); //http500log.info( "\n" + stringWriter.toString() ); String requestString = stringWriter.toString(); if (requestString != null && requestString.length() > MAX_REQ_BODY_DUMP) { requestString = requestString.substring(0, (MAX_REQ_BODY_DUMP - 1)); } http500log.info("\n" + requestString); } } catch (Exception ee) { } } } }
From source file:org.atomserver.testutils.log.Log4jHelperTest.java
public void testSetArbitraryLogLevel() { Log log3 = LogFactory.getLog("org.atomserver.foobar"); log3.debug(//www. j a v a2 s .co m "ArbitraryLogLevel:: This line should get printed because the default level for AppLogLevel is TRACE"); // First let's set AppLogLevel to WARN Log4jHelper.setAppLogLevelToWarn(); log3.debug("ArbitraryLogLevel:: This line should NOT get printed"); // Now let's set log3 to DEBUG Log4jHelper.LogLevel originalLogLevel = Log4jHelper.setLogLevel(log3, Log4jHelper.LogLevel.INFO); log3.info("ArbitraryLogLevel:: This line should get printed (originalLogLevel = " + originalLogLevel + ")"); log3.debug("ArbitraryLogLevel:: This line should NOT get printed"); assertTrue(originalLogLevel.equals(Log4jHelper.LogLevel.WARN)); // Now set it back -- Don't forget to do this!!! Log4jHelper.LogLevel lastLogLevel = Log4jHelper.setLogLevel(log3, originalLogLevel); log3.debug("ArbitraryLogLevel:: This line should get printed (lastLogLevel = " + lastLogLevel); assertTrue(lastLogLevel.equals(Log4jHelper.LogLevel.INFO)); }
From source file:org.avineas.comli.impl.LinkHandler.java
private static void print(Log logger, String prefix, byte[] contents, int offset, int length) { StringBuffer buffer = new StringBuffer(prefix); for (int cnt = 0; cnt < length; cnt++) { int thisByte = contents[cnt + offset] & 0xff; buffer.append(" ").append(Integer.toHexString(thisByte)); }//w w w . java2 s .c om logger.info(buffer.toString()); }
From source file:org.ballerinalang.stdlib.common.CommonTestUtils.java
public static void printDiagnostics(CompileResult timerCompileResult, Log log) { Arrays.asList(timerCompileResult.getDiagnostics()) .forEach(e -> log.info(e.getMessage() + " : " + e.getPosition())); }
From source file:org.benetech.configuration.TestWebServiceConfiguration.java
@Bean public EmbeddedServletContainerFactory servletContainer() throws SQLException, PropertyVetoException { Log logger = LogFactory.getLog(TestWebServiceConfiguration.class); logger.info("Setting up servletContainer"); TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(); factory.setSessionTimeout(10, TimeUnit.MINUTES); return factory; }
From source file:org.cloudata.core.common.util.ReflectionUtils.java
/** * Log the current thread stacks at INFO level. * @param log the logger that logs the stack trace * @param title a descriptive title for the call stacks * @param minInterval the minimum time from the last *//* www. jav a2s . co m*/ public static synchronized void logThreadInfo(Log log, String title, long minInterval) { if (log.isInfoEnabled()) { long now = System.currentTimeMillis(); if (now - previousLogTime >= minInterval * 1000) { previousLogTime = now; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); printThreadInfo(new PrintWriter(buffer), title); log.info(buffer.toString()); } } }
From source file:org.cloudata.core.common.util.StringUtils.java
public static void startupShutdownMessage(Class<?> clazz, String[] args, final org.apache.commons.logging.Log LOG) { final String hostname = getHostname(); final String classname = clazz.getSimpleName(); LOG.info(toStartupShutdownString("STARTUP_MSG: ", new String[] { "Starting " + classname, " host = " + hostname, " args = " + Arrays.asList(args) })); // Runtime.getRuntime().addShutdownHook(new Thread() { // public void run() { // LOG.info(toStartupShutdownString("SHUTDOWN_MSG: ", // new String[] { "Shutting down " + classname + " at " + hostname })); // }//from w ww . j av a 2s . c o m // }); }
From source file:org.codehaus.mojo.license.model.LicenseStore.java
public static LicenseStore createLicenseStore(org.apache.maven.plugin.logging.Log log, String... extraResolver) throws MojoExecutionException { LicenseStore store;/* w w w . j av a 2s .co m*/ try { store = new LicenseStore(); store.addJarRepository(); if (extraResolver != null) { for (String s : extraResolver) { if (StringUtils.isNotEmpty(s)) { log.info("adding extra resolver " + s); store.addRepository(s); } } } store.init(); } catch (IllegalArgumentException ex) { throw new MojoExecutionException("could not obtain the license repository", ex); } catch (IOException ex) { throw new MojoExecutionException("could not obtain the license repository", ex); } return store; }
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 {// w w w . j a v a 2 s. com 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); }