Package org.apache.commons.logging

Examples of org.apache.commons.logging.Log


        pointcut="@annotation(es.internna.annotations.LogDebug)",
        returning="retVal"
    )
    public void afterLog(JoinPoint jp, Object retVal)
    {
        Log log = this.getLog(jp);
        if (log.isDebugEnabled()) log.debug(retVal);
    }
View Full Code Here


import junit.framework.TestCase;

public class CommonsLoggingTest extends TestCase {

  public void testLogging() {       
    Log log = LogFactory.getLog(CommonsLoggingTest.class);
        log.info("Hello");                           
    }  
View Full Code Here

   {
      org.jboss.test.classloader.leak.clstore.ClassLoaderStore.getInstance().storeClassLoader("SERVLET", getClass().getClassLoader());
      org.jboss.test.classloader.leak.clstore.ClassLoaderStore.getInstance().storeClassLoader("SERVLET_TCCL", Thread.currentThread().getContextClassLoader());
      org.jboss.test.classloader.leak.clstore.ClassLoaderStore.getInstance().storeClassLoader("WELD", simpleSessionBean.getClass().getClassLoader());
     
      Log log = LogFactory.getLog("WEBAPP");
      log.info("Logging from " + getClass().getName());
     
      simpleSessionBean.hashCode();
      resp.setContentType("text/text");
      PrintWriter writer = resp.getWriter();
      writer.println("WEBAPP");
View Full Code Here

   private static final long serialVersionUID = 1L;

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      Log log = LogFactory.getLog("WEBAPP");
      log.info("Logging from " + getClass().getName());

      SimpleSessionBean.setBeanDestroyed(false);
      req.getSession().invalidate();

      resp.setContentType("text/text");
View Full Code Here

{
  public static void process(File lexiconFile, File grammarFile, File inFile, File outFile)
    throws Exception
  {
    // Create log
    Log log = new SimpleLog("log");

    // Create factory for SAX parser
    SAXParserFactory parserFactoryImpl = SAXParserFactory.newInstance();
    parserFactoryImpl.setNamespaceAware(true);
View Full Code Here

     * @exception LogConfigurationException if a suitable <code>Log</code>
     *  instance cannot be returned
     */
    public Log getInstance(String name) throws LogConfigurationException {

        Log instance = (Log) instances.get(name);
        if (instance == null) {
            instance = newInstance(name);
            instances.put(name, instance);
        }
        return (instance);
View Full Code Here

     * @exception LogConfigurationException if a new instance cannot
     *  be created
     */
    protected Log newInstance(String name) throws LogConfigurationException {

        Log instance = null;
        try {
            Object params[] = new Object[1];
            params[0] = name;
            instance = (Log) getLogConstructor().newInstance(params);
            if (logMethod != null) {
View Full Code Here

                trace.trace("Envelope : " + mc.getEnvelope());
            }
        }

        // get service log for this message and attach to the message context
        Log serviceLog = LogFactory.getLog(SynapseConstants.SERVICE_LOGGER_PREFIX +
            SynapseConstants.SYNAPSE_SERVICE_NAME);
        ((Axis2MessageContext) synCtx).setServiceLog(serviceLog);

        try {
            // set default fault handler
View Full Code Here

   * The main method for the HBase rest server.
   * @param args command-line arguments
   * @throws Exception exception
   */
  public static void main(String[] args) throws Exception {
    Log LOG = LogFactory.getLog("RESTServer");

    VersionInfo.logVersion();
    Configuration conf = HBaseConfiguration.create();
    // login the server principal (if using secure Hadoop)
    if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
      String machineName = Strings.domainNamePointerToHostName(
        DNS.getDefaultHost(conf.get("hbase.rest.dns.interface", "default"),
          conf.get("hbase.rest.dns.nameserver", "default")));
      User.login(conf, "hbase.rest.keytab.file", "hbase.rest.kerberos.principal",
        machineName);
    }

    RESTServlet servlet = RESTServlet.getInstance(conf);

    Options options = new Options();
    options.addOption("p", "port", true, "Port to bind to [default: 8080]");
    options.addOption("ro", "readonly", false, "Respond only to GET HTTP " +
      "method requests [default: false]");
    options.addOption(null, "infoport", true, "Port for web UI");

    CommandLine commandLine = null;
    try {
      commandLine = new PosixParser().parse(options, args);
    } catch (ParseException e) {
      LOG.error("Could not parse: ", e);
      printUsageAndExit(options, -1);
    }

    // check for user-defined port setting, if so override the conf
    if (commandLine != null && commandLine.hasOption("port")) {
      String val = commandLine.getOptionValue("port");
      servlet.getConfiguration()
          .setInt("hbase.rest.port", Integer.valueOf(val));
      LOG.debug("port set to " + val);
    }

    // check if server should only process GET requests, if so override the conf
    if (commandLine != null && commandLine.hasOption("readonly")) {
      servlet.getConfiguration().setBoolean("hbase.rest.readonly", true);
      LOG.debug("readonly set to true");
    }

    // check for user-defined info server port setting, if so override the conf
    if (commandLine != null && commandLine.hasOption("infoport")) {
      String val = commandLine.getOptionValue("infoport");
      servlet.getConfiguration()
          .setInt("hbase.rest.info.port", Integer.valueOf(val));
      LOG.debug("Web UI port set to " + val);
    }

    @SuppressWarnings("unchecked")
    List<String> remainingArgs = commandLine != null ?
        commandLine.getArgList() : new ArrayList<String>();
View Full Code Here

   * Switches the logger for the given class to DEBUG level.
   *
   * @param clazz  The class for which to switch to debug logging.
   */
  public void enableDebug(Class<?> clazz) {
    Log l = LogFactory.getLog(clazz);
    if (l instanceof Log4JLogger) {
      ((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
    } else if (l instanceof Jdk14Logger) {
      ((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.logging.Log

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.