本文整理汇总了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();
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例7: getLogger
import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public Logger getLogger(String key) {
return new JclLogger(LogFactory.getLog(key));
}
示例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;
}
}
示例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;
}
}
示例10: getLogger
import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public Logger getLogger(Class<?> key) {
return new JclLogger(LogFactory.getLog(key));
}
示例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() + "======================");
}
示例12: MultiLock
import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public MultiLock() {
iLog = LogFactory.getLog(MultiLock.class.getName() + ".lock");
}
示例13: HttpAuthenticator
import org.apache.commons.logging.LogFactory; //导入方法依赖的package包/类
public HttpAuthenticator(final Log log) {
super();
this.log = log != null ? log : LogFactory.getLog(getClass());
}
示例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;
}
示例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();
}