当前位置: 首页>>代码示例>>Java>>正文


Java LogFactory.getLog方法代码示例

本文整理汇总了Java中org.apache.commons.logging.LogFactory.getLog方法的典型用法代码示例。如果您正苦于以下问题:Java LogFactory.getLog方法的具体用法?Java LogFactory.getLog怎么用?Java LogFactory.getLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.logging.LogFactory的用法示例。


在下文中一共展示了LogFactory.getLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public void start() throws Exception {
		if (platform == null) {
			// initialize properties and set them as system wide so Felix can pick them up
			Map<Object, Object> configProperties = getConfigurationProperties();
			System.getProperties().putAll(configProperties);

            platform = new Felix20XPlatform(LogFactory.getLog(Felix20XPlatform.class));
//			switch (FELIX_VERSION) {
//			case V_20X:
//				platform = new Felix20XPlatform(null);
//				break;
//			case V_14X:
//				platform = new Felix14XPlatform();
//				break;
//			// fallback to 10-12 version
//			default:
//				platform = new Felix10XPlatform();
//				break;
//			}

			context = platform.start();
		}
	}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:24,代码来源:FelixPlatform.java

示例2: executeInternal

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
@Override
protected void executeInternal() throws Throwable
{
    String moduleId = super.getModuleId();
    String name = super.getName();
    Log logger = LogFactory.getLog(moduleId + "." + name);
    switch (logLevel)
    {
    case INFO:
        logger.info(message);
        break;
    case WARN:
        logger.warn(message);
        break;
    case ERROR:
        logger.error(message);
        break;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:LoggerModuleComponent.java

示例3: doGet

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
    ) throws ServletException, IOException {

  // Do the authorization
  if (!HttpServer.hasAdministratorAccess(getServletContext(), request,
      response)) {
    return;
  }

  PrintWriter out = ServletUtil.initHTML(response, "Log Level");
  String logName = ServletUtil.getParameter(request, "log");
  String level = ServletUtil.getParameter(request, "level");

  if (logName != null) {
    out.println("<br /><hr /><h3>Results</h3>");
    out.println(MARKER
        + "Submitted Log Name: <b>" + logName + "</b><br />");

    Log log = LogFactory.getLog(logName);
    out.println(MARKER
        + "Log Class: <b>" + log.getClass().getName() +"</b><br />");
    if (level != null) {
      out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />");
    }

    if (log instanceof Log4JLogger) {
      process(((Log4JLogger)log).getLogger(), level, out);
    }
    else if (log instanceof Jdk14Logger) {
      process(((Jdk14Logger)log).getLogger(), level, out);
    }
    else {
      out.println("Sorry, " + log.getClass() + " not supported.<br />");
    }
  }

  out.println(FORMS);
  out.println(ServletUtil.HTML_TAIL);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:LogLevel.java

示例4: AbstractServer

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public AbstractServer(OnlineSectioningServerContext context) throws SectioningException {
	iConfig = new ServerConfig();
	iDistanceMetric = new DistanceMetric(iConfig);
	TravelTime.populateTravelTimes(iDistanceMetric, context.getAcademicSessionId());
	try {
		iActionFactory = ((OnlineSectioningActionFactory)Class.forName(ApplicationProperty.CustomizationOnlineSectioningActionFactory.value()).newInstance());
	} catch (Exception e) {
		LogFactory.getLog(OnlineSectioningServer.class).warn("Failed to initialize online sectioning action factory, using the default one.", e);
		iActionFactory = new SimpleActionFactory();
	}
	org.hibernate.Session hibSession = SessionDAO.getInstance().createNewSession();
	try {
		Session session = SessionDAO.getInstance().get(context.getAcademicSessionId(), hibSession);
		if (session == null)
			throw new SectioningException(MSG.exceptionSessionDoesNotExist(context.getAcademicSessionId() == null ? "null" : context.getAcademicSessionId().toString()));
		AcademicSessionInfo academicSession = new AcademicSessionInfo(session);
		iLog = LogFactory.getLog(OnlineSectioningServer.class.getName() + ".server[" + academicSession.toCompactString() + "]");
		iProperties.put("AcademicSession", academicSession);
		iExecutor = new AsyncExecutor(academicSession);
		iExecutor.start();
	} finally {
		hibSession.close();
	}
	iLog.info("Config: " + ToolBox.dict2string(iConfig, 2));
	
	load(context);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:28,代码来源:AbstractServer.java

示例5: ClusterContainer

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
/**
 * Basic constructor
 */
public ClusterContainer() {
    servers = new HashMap();
    statusChecker = new ServerStatusChecker(this, 5*60*1000);
    statusChecker.start();
    log = LogFactory.getLog(ClusterContainer.class);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:ClusterContainer.java

示例6: TransactionalCache

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
/**
 * Public constructor.
 */
public TransactionalCache()
{
    logger = LogFactory.getLog(TransactionalCache.class);
    isDebugEnabled = logger.isDebugEnabled();
    disableSharedCache = false;
    isMutable = true;
    allowEqualsChecks = false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:TransactionalCache.java

示例7: getLogger

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public Logger getLogger(String key) {
	return new JclLogger(LogFactory.getLog(key));
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:4,代码来源:JclLoggerAdapter.java

示例8: getRequestLog

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public static RequestLog getRequestLog(String name) {

    String lookup = serverToComponent.get(name);
    if (lookup != null) {
      name = lookup;
    }
    String loggerName = "http.requests." + name;
    String appenderName = name + "requestlog";
    Log logger = LogFactory.getLog(loggerName);

    if (logger instanceof Log4JLogger) {
      Log4JLogger httpLog4JLog = (Log4JLogger)logger;
      Logger httpLogger = httpLog4JLog.getLogger();
      Appender appender = null;

      try {
        appender = httpLogger.getAppender(appenderName);
      } catch (LogConfigurationException e) {
        LOG.warn("Http request log for " + loggerName
            + " could not be created");
        throw e;
      }

      if (appender == null) {
        LOG.info("Http request log for " + loggerName
            + " is not defined");
        return null;
      }

      if (appender instanceof HttpRequestLogAppender) {
        HttpRequestLogAppender requestLogAppender
          = (HttpRequestLogAppender)appender;
        NCSARequestLog requestLog = new NCSARequestLog();
        requestLog.setFilename(requestLogAppender.getFilename());
        requestLog.setRetainDays(requestLogAppender.getRetainDays());
        return requestLog;
      } else {
        LOG.warn("Jetty request log for " + loggerName
            + " was of the wrong class");
        return null;
      }
    }
    else {
      LOG.warn("Jetty request log can only be enabled using Log4j");
      return null;
    }
  }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:48,代码来源:HttpRequestLog.java

示例9: getRequestLog

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public static RequestLog getRequestLog(String name) {

    String lookup = serverToComponent.get(name);
    if (lookup != null) {
      name = lookup;
    }
    String loggerName = "http.requests." + name;
    String appenderName = name + "requestlog";
    Log logger = LogFactory.getLog(loggerName);

    boolean isLog4JLogger;;
    try {
      isLog4JLogger = logger instanceof Log4JLogger;
    } catch (NoClassDefFoundError err) {
      // In some dependent projects, log4j may not even be on the classpath at
      // runtime, in which case the above instanceof check will throw
      // NoClassDefFoundError.
      LOG.debug("Could not load Log4JLogger class", err);
      isLog4JLogger = false;
    }
    if (isLog4JLogger) {
      Log4JLogger httpLog4JLog = (Log4JLogger)logger;
      Logger httpLogger = httpLog4JLog.getLogger();
      Appender appender = null;

      try {
        appender = httpLogger.getAppender(appenderName);
      } catch (LogConfigurationException e) {
        LOG.warn("Http request log for " + loggerName
            + " could not be created");
        throw e;
      }

      if (appender == null) {
        LOG.info("Http request log for " + loggerName
            + " is not defined");
        return null;
      }

      if (appender instanceof HttpRequestLogAppender) {
        HttpRequestLogAppender requestLogAppender
          = (HttpRequestLogAppender)appender;
        NCSARequestLog requestLog = new NCSARequestLog();
        requestLog.setFilename(requestLogAppender.getFilename());
        requestLog.setRetainDays(requestLogAppender.getRetainDays());
        return requestLog;
      }
      else {
        LOG.warn("Jetty request log for " + loggerName
            + " was of the wrong class");
        return null;
      }
    }
    else {
      LOG.warn("Jetty request log can only be enabled using Log4j");
      return null;
    }
  }
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:59,代码来源:HttpRequestLog.java

示例10: getLogger

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public Logger getLogger(Class<?> key) {
    return new JclLogger(LogFactory.getLog(key));
}
 
开发者ID:yunhaibin,项目名称:dubbox-hystrix,代码行数:4,代码来源:JclLoggerAdapter.java

示例11: AbstractCase

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
/**
 * コンストラクタ.
 * @param build WebAppDescriptor
 */
public AbstractCase(WebAppDescriptor build) {
    super(build);
    log = LogFactory.getLog(AbstractCase.class);
    log.debug("======================" + this.getClass().getName() + "======================");
}
 
开发者ID:personium,项目名称:personium-core,代码行数:10,代码来源:AbstractCase.java

示例12: MultiLock

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public MultiLock() {
	iLog = LogFactory.getLog(MultiLock.class.getName() + ".lock");
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:4,代码来源:MultiLock.java

示例13: HttpAuthenticator

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public HttpAuthenticator(final Log log) {
    super();
    this.log = log != null ? log : LogFactory.getLog(getClass());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:HttpAuthenticator.java

示例14: TokenAspect

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
TokenAspect(T fs, final Text serviceName, final Text kind) {
  this.LOG = LogFactory.getLog(fs.getClass());
  this.fs = fs;
  this.dtSelector = new DTSelecorByKind(kind);
  this.serviceName = serviceName;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:TokenAspect.java

示例15: UrlRewritingOutputStream

import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
/**
 * Basic constructor.
 * 
 * pock: For BES we use a new server for every request. We can't determine
 * this server from the serverChain --> use the server of the request as
 * parameter (Bug 5487)
 * 
 * @param originalStream
 *            The stream we are wrapping
 * @param encoding
 *            The encoding to be used for later URL rewriting.
 */
public UrlRewritingOutputStream(ServletOutputStream originalStream,
        String contextPath, String encoding) {
    this.originalStream = originalStream;
    this.contextPath = contextPath;
    this.encoding = encoding;
    log = LogFactory.getLog(UrlRewritingOutputStream.class);

    stream = new ByteArrayOutputStream();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:22,代码来源:UrlRewritingOutputStream.java


注:本文中的org.apache.commons.logging.LogFactory.getLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。