本文整理了Java中org.apache.catalina.Context.getLogger()
方法的一些代码示例,展示了Context.getLogger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getLogger()
方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:getLogger
暂无
代码示例来源:origin: apache/geode
dsm.removeTouchedSession(session.getId());
session.commit();
if (dsm.getTheContext().getLogger().isDebugEnabled()) {
dsm.getTheContext().getLogger().debug(session + ": Committed.");
if (dsm.getTheContext().getLogger().isDebugEnabled()) {
dsm.getTheContext().getLogger().debug(session + ": Not valid so not committing.");
代码示例来源:origin: psi-probe/psi-probe
/**
* Gets the catalina log destination.
*
* @param ctx the ctx
* @param application the application
* @return the catalina log destination
*/
private LogDestination getCatalinaLogDestination(Context ctx, Application application) {
Object log = ctx.getLogger();
if (log != null) {
CatalinaLoggerAccessor logAccessor = new CatalinaLoggerAccessor();
logAccessor.setTarget(log);
logAccessor.setApplication(application);
if (logAccessor.getFile().exists()) {
return logAccessor;
}
}
return null;
}
代码示例来源:origin: psi-probe/psi-probe
/**
* Gets the commons log destination.
*
* @param ctx the ctx
* @param application the application
* @param logIndex the log index
* @return the commons log destination
*/
private LogDestination getCommonsLogDestination(Context ctx, Application application,
String logIndex) {
Object contextLogger = ctx.getLogger();
CommonsLoggerAccessor commonsAccessor = new CommonsLoggerAccessor();
commonsAccessor.setTarget(contextLogger);
commonsAccessor.setApplication(application);
return commonsAccessor.getDestination(logIndex);
}
代码示例来源:origin: psi-probe/psi-probe
Application application = ApplicationUtils.getApplication(ctx, getContainerWrapper());
ClassLoader cl = ctx.getLoader().getClassLoader();
Object contextLogger = ctx.getLogger();
if (contextLogger != null) {
if (contextLogger.getClass().getName().startsWith("org.apache.commons.logging")) {
代码示例来源:origin: stackoverflow.com
public class LambdaFunctionHandler implements RequestStreamHandler {
@Override
public void handleRequest(InputStream inputStream, OutputStream output, Context context) throws IOException {
byte serializedSpeechletRequest[] = IOUtils.toByteArray(inputStream);
SpeechletRequestEnvelope requestEnvelope = SpeechletRequestEnvelope.fromJson(serializedSpeechletRequest);
SpeechletRequest speechletRequest = requestEnvelope.getRequest();
if (speechletRequest instanceof IntentRequest) {
IntentRequest ir = (IntentRequest) speechletRequest;
String outString = "IntentRequest name: " + ir.getIntent().getName();
context.getLogger().log(outString);
output.write(outString.getBytes());
}
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Set the JNDI name of a DataSource-factory to use for db access
*
* @param dataSourceName The JNDI name of the DataSource-factory
*/
public void setDataSourceName(String dataSourceName) {
if (dataSourceName == null || "".equals(dataSourceName.trim())) {
manager.getContext().getLogger().warn(
sm.getString(getStoreName() + ".missingDataSourceName"));
return;
}
this.dataSourceName = dataSourceName;
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Set the JNDI name of a DataSource-factory to use for db access
*
* @param dataSourceName The JNDI name of the DataSource-factory
*/
public void setDataSourceName(String dataSourceName) {
if (dataSourceName == null || "".equals(dataSourceName.trim())) {
manager.getContext().getLogger().warn(
sm.getString(getStoreName() + ".missingDataSourceName"));
return;
}
this.dataSourceName = dataSourceName;
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Set the JNDI name of a DataSource-factory to use for db access
*
* @param dataSourceName The JNDI name of the DataSource-factory
*/
public void setDataSourceName(String dataSourceName) {
if (dataSourceName == null || "".equals(dataSourceName.trim())) {
manager.getContext().getLogger().warn(
sm.getString(getStoreName() + ".missingDataSourceName"));
return;
}
this.dataSourceName = dataSourceName;
}
代码示例来源:origin: tomcat/catalina
/**
* Release the Filter instance associated with this FilterConfig,
* if there is one.
*/
void release() {
if (this.filter != null){
if( System.getSecurityManager() != null) {
try{
SecurityUtil.doAsPrivilege("destroy", filter);
} catch(java.lang.Exception ex){
context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
}
SecurityUtil.remove(filter);
} else {
filter.destroy();
}
}
this.filter = null;
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Log a message on the Logger associated with our Container (if any).
*
* @param message Message to be logged
* @param t Associated exception
*/
protected void log(String message, Throwable t) {
message = neutralizeForLog(message);
org.apache.catalina.Logger logger = context.getLogger();
if (logger != null) {
logger.log("Authenticator[" + context.getPath() + "]: " +
message, t, org.apache.catalina.Logger.WARNING);
} else {
String msg = MessageFormat.format(rb.getString(LogFacade.AUTHENTICATOR_INFO),
new Object[] {context.getPath(), message});
log.log(Level.WARNING, msg, t);
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Log a message on the Logger associated with our Container (if any).
*
* @param message Message to be logged
*/
protected void log(String message) {
message = neutralizeForLog(message);
org.apache.catalina.Logger logger = context.getLogger();
if (logger != null) {
logger.log("Authenticator[" + context.getPath() + "]: " +
message);
} else {
if (log.isLoggable(Level.INFO)) {
log.log(Level.INFO, LogFacade.AUTHENTICATOR_INFO, new Object[] {context.getPath(), message});
}
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Remove the Session with the specified session identifier from
* this Store, if present. If no such Session is present, this method
* takes no action.
*
* @param id Session identifier of the Session to be removed
*
* @exception IOException if an input/output error occurs
*/
@Override
public void remove(String id) throws IOException {
File file = file(id);
if (file == null) {
return;
}
if (manager.getContext().getLogger().isDebugEnabled()) {
manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".removing",
id, file.getAbsolutePath()));
}
if (file.exists() && !file.delete()) {
throw new IOException(sm.getString("fileStore.deleteSessionFailed", file));
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Save the specified Session into this Store. Any previously saved
* information for the associated session identifier is replaced.
*
* @param session Session to be saved
*
* @exception IOException if an input/output error occurs
*/
@Override
public void save(Session session) throws IOException {
// Open an output stream to the specified pathname, if any
File file = file(session.getIdInternal());
if (file == null) {
return;
}
if (manager.getContext().getLogger().isDebugEnabled()) {
manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".saving",
session.getIdInternal(), file.getAbsolutePath()));
}
try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(fos))) {
((StandardSession)session).writeObjectData(oos);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Remove the Session with the specified session identifier from
* this Store, if present. If no such Session is present, this method
* takes no action.
*
* @param id Session identifier of the Session to be removed
*
* @exception IOException if an input/output error occurs
*/
@Override
public void remove(String id) throws IOException {
File file = file(id);
if (file == null) {
return;
}
if (manager.getContext().getLogger().isDebugEnabled()) {
manager.getContext().getLogger().debug(sm.getString(getStoreName()+".removing",
id, file.getAbsolutePath()));
}
file.delete();
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Check the connection associated with this store, if it's
* <code>null</code> or closed try to reopen it.
* Returns <code>null</code> if the connection could not be established.
*
* @return <code>Connection</code> if the connection succeeded
*/
protected Connection getConnection() {
Connection conn = null;
try {
conn = open();
if (conn == null || conn.isClosed()) {
manager.getContext().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBClosed"));
conn = open();
if (conn == null || conn.isClosed()) {
manager.getContext().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBReOpenFail"));
}
}
} catch (SQLException ex) {
manager.getContext().getLogger().error(sm.getString(getStoreName() + ".checkConnectionSQLException",
ex.toString()));
}
return conn;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Check the connection associated with this store, if it's
* <code>null</code> or closed try to reopen it.
* Returns <code>null</code> if the connection could not be established.
*
* @return <code>Connection</code> if the connection succeeded
*/
protected Connection getConnection() {
Connection conn = null;
try {
conn = open();
if (conn == null || conn.isClosed()) {
manager.getContext().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBClosed"));
conn = open();
if (conn == null || conn.isClosed()) {
manager.getContext().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBReOpenFail"));
}
}
} catch (SQLException ex) {
manager.getContext().getLogger().error(sm.getString(getStoreName() + ".checkConnectionSQLException",
ex.toString()));
}
return conn;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Attempt to load a class using the given Container's class loader. If the
* class cannot be loaded, a debug level log message will be written to the
* Container's log and null will be returned.
* @param context The class loader of this context will be used to attempt
* to load the class
* @param className The class name
* @return the loaded class or <code>null</code> if loading failed
*/
public static Class<?> loadClass(Context context, String className) {
ClassLoader cl = context.getLoader().getClassLoader();
Log log = context.getLogger();
Class<?> clazz = null;
try {
clazz = cl.loadClass(className);
} catch (ClassNotFoundException | NoClassDefFoundError | ClassFormatError e) {
log.debug(sm.getString("introspection.classLoadFailed", className), e);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.debug(sm.getString("introspection.classLoadFailed", className), t);
}
return clazz;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
public DefaultInstanceManager(Context context,
Map<String, Map<String, String>> injectionMap,
org.apache.catalina.Context catalinaContext,
ClassLoader containerClassLoader) {
classLoader = catalinaContext.getLoader().getClassLoader();
privileged = catalinaContext.getPrivileged();
this.containerClassLoader = containerClassLoader;
ignoreAnnotations = catalinaContext.getIgnoreAnnotations();
Log log = catalinaContext.getLogger();
Set<String> classNames = new HashSet<>();
loadProperties(classNames,
"org/apache/catalina/core/RestrictedServlets.properties",
"defaultInstanceManager.restrictedServletsResource", log);
loadProperties(classNames,
"org/apache/catalina/core/RestrictedListeners.properties",
"defaultInstanceManager.restrictedListenersResource", log);
loadProperties(classNames,
"org/apache/catalina/core/RestrictedFilters.properties",
"defaultInstanceManager.restrictedFiltersResource", log);
restrictedClasses = Collections.unmodifiableSet(classNames);
this.context = context;
this.injectionMap = injectionMap;
this.postConstructMethods = catalinaContext.findPostConstructMethods();
this.preDestroyMethods = catalinaContext.findPreDestroyMethods();
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Perform the internal processing required to passivate
* this session.
*/
public void passivate() {
// Notify interested session event listeners
fireSessionEvent(Session.SESSION_PASSIVATED_EVENT, null);
// Notify ActivationListeners
HttpSessionEvent event = null;
String keys[] = keys();
for (int i = 0; i < keys.length; i++) {
Object attribute = attributes.get(keys[i]);
if (attribute instanceof HttpSessionActivationListener) {
if (event == null)
event = new HttpSessionEvent(getSession());
try {
((HttpSessionActivationListener)attribute)
.sessionWillPassivate(event);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
manager.getContext().getLogger().error
(sm.getString("standardSession.attributeEvent"), t);
}
}
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Attempt to load a class using the given Container's class loader. If the
* class cannot be loaded, a debug level log message will be written to the
* Container's log and null will be returned.
*/
public static Class<?> loadClass(Context context, String className) {
ClassLoader cl = context.getLoader().getClassLoader();
Log log = context.getLogger();
Class<?> clazz = null;
try {
clazz = cl.loadClass(className);
} catch (ClassNotFoundException e) {
log.debug(sm.getString("introspection.classLoadFailed"), e);
} catch (NoClassDefFoundError e) {
log.debug(sm.getString("introspection.classLoadFailed"), e);
} catch (ClassFormatError e) {
log.debug(sm.getString("introspection.classLoadFailed"), e);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.debug(sm.getString("introspection.classLoadFailed"), t);
}
return clazz;
}
内容来源于网络,如有侵权,请联系作者删除!