本文整理汇总了Java中org.apache.openejb.util.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于org.apache.openejb.util包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: print
import org.apache.openejb.util.Logger; //导入依赖的package包/类
public void print(final Logger log, boolean formatXml) {
if (log.isDebugEnabled()) {
final StringBuilder builder = new StringBuilder();
builder.append("******************* REQUEST ******************\n");
builder.append(method).append(" ").append(uri).append("\n");
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
builder.append(entry).append("\n");
}
builder.append("\n");
final String text = new String(body);
if (formatXml && OpenEJBHttpServer.isTextXml(headers)) {
builder.append(OpenEJBHttpServer.reformat(text)).append("\n");
} else {
builder.append(text).append("\n");
}
builder.append("**********************************************").append("\n");
log.debug(builder.toString());
}
}
示例2: destroyResource
import org.apache.openejb.util.Logger; //导入依赖的package包/类
@Override
public void destroyResource() {
// try to clean up
try {
final Field f = TransactionManagerImpl.class.getDeclaredField("retryScheduler");
f.setAccessible(true);
final ExponentialtIntervalRetryScheduler rs = ExponentialtIntervalRetryScheduler.class.cast(f.get(this));
final Field t = ExponentialtIntervalRetryScheduler.class.getDeclaredField("timer");
t.setAccessible(true);
final Timer timer = Timer.class.cast(t.get(rs));
timer.cancel();
} catch (final Throwable notImportant) {
// no-op
}
if (txLog != null) {
try {
HOWLLog.class.cast(txLog).doStop();
} catch (final Throwable /*Exception + NoClassDefFoundError*/ e) {
Logger.getInstance(LogCategory.OPENEJB, DestroyableTransactionManager.class).error(e.getMessage(), e);
}
}
}
示例3: newPatchedBrokerService
import org.apache.openejb.util.Logger; //导入依赖的package包/类
private BrokerService newPatchedBrokerService() {
return new BrokerService() {
@Override
public NetworkConnector addNetworkConnector(final URI discoveryAddress) throws Exception {
final NetworkConnector connector = new DiscoveryNetworkConnector(discoveryAddress);
try { // try to set properties to broker too
final Map<String, String> props = URISupport.parseParameters(discoveryAddress);
if (!props.containsKey("skipConnector")) {
IntrospectionSupport.setProperties(connector, props);
}
} catch (final URISyntaxException e) {
// low level cause not supported by AMQ by default
Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQ5Factory.class).getChildLogger("service")
.debug(e.getMessage());
}
return addNetworkConnector(connector);
}
};
}
示例4: createInternalBroker
import org.apache.openejb.util.Logger; //导入依赖的package包/类
private void createInternalBroker(final String brokerXmlConfig, final Properties properties) {
ActiveMQFactory.setThreadProperties(properties);
try {
//The returned broker should be started, but calling start is harmless.
//We do not need to track the instance as the factory takes care of this.
ActiveMQFactory.createBroker(URLs.uri(getBrokerXmlConfig())).start();
} catch (final Exception e) {
Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").fatal("Failed to start ActiveMQ", e);
} finally {
ActiveMQFactory.setThreadProperties(null);
// reset brokerXmlConfig
if (brokerXmlConfig != null) {
setBrokerXmlConfig(brokerXmlConfig);
}
}
}
示例5: stopImpl
import org.apache.openejb.util.Logger; //导入依赖的package包/类
private void stopImpl() throws Exception {
super.stop();
final Collection<BrokerService> brokers = ActiveMQFactory.getBrokers();
final Iterator<BrokerService> it = brokers.iterator();
while (it.hasNext()) {
final BrokerService bs = it.next();
try {
bs.stop();
bs.waitUntilStopped();
} catch (final Throwable t) {
//Ignore
}
it.remove();
}
stopScheduler();
Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").info("Stopped ActiveMQ broker");
}
示例6: createExecutorService
import org.apache.openejb.util.Logger; //导入依赖的package包/类
private ExecutorService createExecutorService() {
final BlockingQueue<Runnable> blockingQueue;
if (queue <= 0) {
blockingQueue = new LinkedBlockingQueue<>();
} else {
blockingQueue = new ArrayBlockingQueue<>(queue);
}
ManagedThreadFactory managedThreadFactory;
try {
managedThreadFactory = "org.apache.openejb.threads.impl.ManagedThreadFactoryImpl".equals(threadFactory) ?
new ManagedThreadFactoryImpl() :
ThreadFactories.findThreadFactory(threadFactory);
} catch (final Exception e) {
Logger.getInstance(LogCategory.OPENEJB, ManagedExecutorServiceImplFactory.class).warning("Can't create configured thread factory: " + threadFactory, e);
managedThreadFactory = new ManagedThreadFactoryImpl();
}
return new ThreadPoolExecutor(core, max, keepAlive.getTime(), keepAlive.getUnit(), blockingQueue, managedThreadFactory, CURejectHandler.INSTANCE);
}
示例7: logInTomEE
import org.apache.openejb.util.Logger; //导入依赖的package包/类
private Principal logInTomEE(final Principal pcp) {
if (pcp == null) {
return null;
}
if (securityService == null) { // tomee-embedded get it later than startInternals so we need it this way
securityService = (TomcatSecurityService) SystemInstance.get().getComponent(SecurityService.class);
}
// normally we don't care about oldstate because the listener already contains one
// which is the previous one
// so no need to clean twice here
final Request request = OpenEJBSecurityListener.requests.get();
if (request != null) {
final Object securityContext = securityService.enterWebApp(this, pcp, OpenEJBSecurityListener.requests.get().getWrapper().getRunAs());
request.setNote(SECURITY_NOTE, securityContext);
} else {
final CUTask.Context context = CUTask.Context.CURRENT.get();
if (context != null) {
final Object state = securityService.enterWebApp(this, pcp, null);
context.pushExitTask(new Runnable() {
@Override
public void run() {
securityService.exitWebApp(state);
}
});
} else {
final Logger instance = Logger.getInstance(LogCategory.OPENEJB_SECURITY, TomEERealm.class);
if (instance.isDebugEnabled()) {
instance.debug(
"No request or concurrency-utilities context so skipping login context propagation, " +
"thread=" + Thread.currentThread().getName());
}
}
}
return pcp;
}
示例8: Tracker
import org.apache.openejb.util.Logger; //导入依赖的package包/类
public Tracker(final String group, final long heartRate, final int maxMissedHeartbeats, final long reconnectDelay, final long maxReconnectDelay, final int maxReconnectAttempts, final long exponentialBackoff, final Logger log, final boolean debug) {
this.group = group;
this.groupPrefix = group + ":";
this.heartRate = heartRate;
this.maxMissedHeartbeats = maxMissedHeartbeats;
this.reconnectDelay = reconnectDelay;
this.maxReconnectDelay = maxReconnectDelay;
this.maxReconnectAttempts = maxReconnectAttempts;
this.exponentialBackoff = exponentialBackoff;
this.useExponentialBackOff = exponentialBackoff > 1;
this.log = log;
this.debug = debug;
this.log.info("Created " + this);
}
示例9: resolve
import org.apache.openejb.util.Logger; //导入依赖的package包/类
@Override
public Object resolve(final EJBHomeHandler handler) {
try {
final EJBMetaDataImpl ejb = handler.getEjb();
final InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null) ? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;
final ArrayList<Class> interfaces = new ArrayList<Class>();
if (interfaceType.isBusiness()) {
interfaces.addAll(ejb.getBusinessClasses());
} else {
interfaces.add(ejb.getRemoteInterfaceClass());
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext(ejb.getDeploymentID());
return EjbHomeProxyHandler.createHomeProxy(beanContext, interfaceType, interfaces, ejb.getMainInterface());
} catch (Exception e) {
Logger.getInstance(LogCategory.OPENEJB_SERVER_REMOTE, "org.apache.openejb.server.util.resources")
.error("ServerSideResolver.resolve() failed, falling back to ClientSideResolver: " +
e.getClass().getName() +
": " +
e.getMessage(), e);
return new EJBHomeProxyHandle.ClientSideResovler().resolve(handler);
}
}
示例10: initCxfClassHelper
import org.apache.openejb.util.Logger; //导入依赖的package包/类
public static void initCxfClassHelper() {
if (!Boolean.parseBoolean(SystemInstance.get().getProperty("openejb.cxf.ClassHelper.patch", "true"))) {
return;
}
try {
Reflections.set(ClassHelper.class, null, "HELPER", new OpenEJBClassHelper());
} catch (final Throwable throwable) {
// no more a big deal normally since CXF uses our ClassUnwrapper
Logger.getInstance(LogCategory.CXF, CxfHacks.class).info("Can't set OpenEJBClassHelper.");
}
}
示例11: create
import org.apache.openejb.util.Logger; //导入依赖的package包/类
@Override
public Object create() {
try {
toClean = bm.createCreationalContext(bean);
return bm.getReference(bean, bean.getBeanClass(), toClean);
} catch (final InjectionException ie) {
final String msg = "Failed to instantiate: " + bean;
Logger.getInstance(LogCategory.OPENEJB_CDI, this.getClass()).error(msg, ie);
throw new WebApplicationException(Response.serverError().entity(msg).build());
}
}
示例12: getLooger
import org.apache.openejb.util.Logger; //导入依赖的package包/类
protected java.util.logging.Logger getLooger() throws Exception {
final Logger logger = Logger.getInstance(LogCategory.OPENEJB_RS, RESTService.class);
final LogStreamAsync stream = LogStreamAsync.class.cast(Reflections.get(logger, "logStream"));
final JuliLogStream ls = JuliLogStream.class.cast(Reflections.get(stream, "ls"));
final LoggerCreator julCreator = LoggerCreator.class.cast(Reflections.get(ls, "logger"));
return julCreator.call();
}
示例13: configureLoggin
import org.apache.openejb.util.Logger; //导入依赖的package包/类
protected void configureLoggin() throws Exception {
msgs = new LinkedList<>();
final java.util.logging.Logger looger = getLooger();
looger.addHandler(new Handler() {
@Override
public void publish(final LogRecord record) {
synchronized (LoggingJAXRSCommons.this) {
msgs.add(record.getMessage());
}
}
@Override
public void flush() {
// no-op
}
@Override
public void close() throws SecurityException {
// no-op
}
public Collection getMsg() {
synchronized (LoggingJAXRSCommons.this) {
return msgs;
}
}
});
}
示例14: init
import org.apache.openejb.util.Logger; //导入依赖的package包/类
@Override
public void init(final Properties props) throws Exception {
this.logger = Logger.getInstance(LogCategory.OPENEJB_SERVER.createChild("service." + getName()), "org.apache.openejb.server.util.resources");
this.debug = this.logger.isDebugEnabled();
super.init(props);
}
示例15: PostConstruct
import org.apache.openejb.util.Logger; //导入依赖的package包/类
@PostConstruct
public void PostConstruct(final InvocationContext invocationContext) throws Exception {
final long start = System.nanoTime();
record(invocationContext, PostConstruct());
final long end = System.nanoTime();
Logger.getInstance(LogCategory.MONITORING, "org.apache.openejb.monitoring")
.debug("instance.created", invocationContext.getTarget().getClass().getName(), end - start);
}