/** * Returns true if the passed in principal belongs to at least one of the * roles in the passed in list of roles. * * @param principal Principal to check against roles * @param roles list of roles * @return true if principal belongs to at least one of the roles in the list */ public boolean checkRoles(Principal principal, List roles) { if (loginCommand == null) // This should not happen but just in case. { if (Log.isWarn()) Log.getLogger(LOG_CATEGORY).warn ("Login command is null. Please ensure that the login-command" + " tag has the correct server attribute value" + ", or use 'all' to use the login command regardless of the server."); return false; } return loginCommand.doAuthorization(principal, roles); }
Log.removeTarget(this); synchronized (lock) usingDefaultFilter = false; Log.addTarget(this);
/** * Starts the <code>JMSProducer</code>. Subclasses should call <code>super.start</code>. */ public void start() throws NamingException, JMSException { super.start(); if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName +"' is starting."); }
if (Log.isDebug()) Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug( "Before handling general client poll request. " + StringUtils.NEWLINE + " incomingMessage: " + pollCommand + StringUtils.NEWLINE); if (Log.isDebug()) String debugPollResult = Log.getPrettyPrinter().prettify(pollResponse); Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug( "After handling general client poll request. " + StringUtils.NEWLINE + " reply: " + debugPollResult + StringUtils.NEWLINE);
/** * @exclude * Removes a subscription from the subscription set for this MessageClient. * * @param selector The selector expression for the subscription. * @param subtopic The subtopic for the subscription. * @return true if no subscriptions remain for this MessageClient; otherwise false. */ public boolean removeSubscription(String selector, String subtopic) { synchronized (lock) { if (subscriptions.remove(new SubscriptionInfo(selector, subtopic))) return decrementReferences(); else if (Log.isError()) Log.getLogger(MessageService.LOG_CATEGORY).error("Error - unable to find subscription to remove for MessageClient: " + clientId + " selector: " + selector + " subtopic: " + subtopic); return numReferences == 0; } }
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
/** * This is called remotely from other cluster members when a new remote subscription is identified. * * We add or remove a remote subscription... */ public void subscribeFromPeer(String destinationId, Boolean subscribe, String selector, String subtopic, Object remoteAddress) { Destination destination = getDestination(destinationId); RemoteSubscriptionManager subMgr = ((MessageDestination) destination).getRemoteSubscriptionManager(); if (destination instanceof MessageDestination) { if (Log.isDebug()) Log.getLogger(MessageService.LOG_CATEGORY).debug("Received subscription from peer: " + remoteAddress + " subscribe? " + subscribe + " selector: " + selector + " subtopic: " + subtopic); if (subscribe.booleanValue()) subMgr.addSubscriber(remoteAddress, selector, subtopic, null); else subMgr.removeSubscriber(remoteAddress, selector, subtopic, null); } else if (Log.isError()) Log.getLogger(LOG_CATEGORY).error("subscribeFromPeer called with destination: " + destinationId + " that is not a MessageDestination"); }
if (preferredLevel < Log.getTargetLevel()) return; Log.getLogger(LogCategories.MESSAGE_GENERAL).fatal(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).error(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).warn(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).info(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).debug(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).fatal("Failed to log exception for handling message due to an invalid preferred log level: " + preferredLevel); break;
/** * Constructs a <code>PropertyStringResourceLoader</code> that will use the * specified property bundles to use for string lookups. * * @param propertyBundles The list of the property bundles to use for lookups. */ public PropertyStringResourceLoader(String[] propertyBundles) { this.propertyBundles = propertyBundles; logger = Log.getLogger(LOG_CATEGORY); }
Log.setPrettyPrinterClass(ToStringPrettyPrinter.class.getName()); return; Log.createLog(); Log.setPrettyPrinterClass(ToStringPrettyPrinter.class.getName()); Log.initialize(null, properties); target.setLevel(Log.readLevel(targetSettings.getLevel())); target.setFilters(targetSettings.getFilters()); target.initialize(null, targetSettings.getProperties()); Log.addTarget(target);
@Override protected String toStringFields(int indentLevel) { String sep = getFieldSeparator(indentLevel); String s = sep + "clientId = " + (Log.isExcludedProperty("clientId") ? Log.VALUE_SUPRESSED : clientId); s += sep + "correlationId = " + (Log.isExcludedProperty("correlationId") ? Log.VALUE_SUPRESSED : correlationId); s += sep + "destination = " + (Log.isExcludedProperty("destination") ? Log.VALUE_SUPRESSED : destination); s += sep + "messageId = " + (Log.isExcludedProperty("messageId") ? Log.VALUE_SUPRESSED : messageId); s += sep + "timestamp = " + (Log.isExcludedProperty("timestamp") ? Log.VALUE_SUPRESSED : String.valueOf(timestamp)); s += sep + "timeToLive = " + (Log.isExcludedProperty("timeToLive") ? Log.VALUE_SUPRESSED : String.valueOf(timeToLive)); s += sep + "body = " + (Log.isExcludedProperty("body") ? Log.VALUE_SUPRESSED : bodyToString(body, indentLevel)); s += super.toStringFields(indentLevel); return s; }
if (targets.size() > 0 && (!verifyLevel || (level >= Log.getTargetLevel()))) PrettyPrinter prettyPrinter = Log.getPrettyPrinter();
/** * @param filter * @return whether the filter is valid (with or without a trailing .*) */ public boolean checkFilter(String filter) { for (int i = 0; i < categories.size(); i++) { if (Log.checkFilterToCategory((String)filter, (String)categories.get(i))) { return true; } } return false; }
private int internalParsePort(String url) { int port = ChannelSettings.parsePort(url); // If there is no specified port, log an info message as urls without ports are supported if (port == 0 && Log.isInfo()) log.info("No port specified in channel URL: {0}", new Object[]{url}); return port == -1? 0 : port; // Replace -1 with 0. }
if (Log.isDebug()) Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug( "Before handling general client poll request. " + StringUtils.NEWLINE + " incomingMessage: " + pollCommand + StringUtils.NEWLINE); if (Log.isDebug()) String debugPollResult = Log.getPrettyPrinter().prettify(pollResponse); Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug( "After handling general client poll request. " + StringUtils.NEWLINE + " reply: " + debugPollResult + StringUtils.NEWLINE);
/** * Handles command execution problems by notifying the FailedExecutionHandler if one has been set * and otherwise logging the failure. * * @param command The command that failed to execute successfully. * @param e The exception generated by the failed command. */ private void handleFailedExecution(Runnable command, Exception e) { FailedExecutionHandler handler = getFailedExecutionHandler(); if (handler != null) { handler.failedExecution(command, this, e); } else if (Log.isError()) { Log.getLogger(LogCategories.EXECUTOR).error("AsynchBeansWorkManager hit an Exception but no FailedExecutionHandler is registered to handle the error.", e); } }
/** * Starts the <code>JMSProducer</code>. Subclasses should call <code>super.start</code>. */ public void start() throws NamingException, JMSException { super.start(); if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName +"' is starting."); }
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
if (preferredLevel < Log.getTargetLevel()) return; Log.getLogger(LogCategories.MESSAGE_GENERAL).fatal(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).error(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).warn(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).info(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).debug(output.toString()); break; Log.getLogger(LogCategories.MESSAGE_GENERAL).fatal("Failed to log exception for handling message due to an invalid preferred log level: " + preferredLevel); break;