/** * Log at error level. * * @param message message to log * @param t ecxeption occured */ public void error(String message, Throwable t) { // Must not be final so that we can mock it in EasyMock for our tests logHandler.error(message, t); if (debugStore != null) { debugStore.log(message, t); } }
private void initDiscoveryMulticast(Configuration pConfig) { String url = findAgentUrl(pConfig); if (url != null || listenForDiscoveryMcRequests(pConfig)) { backendManager.getAgentDetails().setUrl(url); try { discoveryMulticastResponder = new DiscoveryMulticastResponder(backendManager, restrictor, logHandler); discoveryMulticastResponder.start(); } catch (IOException e) { logHandler.error("Cannot start discovery multicast handler: " + e, e); } } }
/** * Create a restrictor restrictor to use. By default, a policy file is looked up (with the URL * given by the init parameter {@link ConfigKey#POLICY_LOCATION} or "/jolokia-access.xml" by * default) and if not found an {@link AllowAllRestrictor} is used by default. This method is * called during the {@link #init(ServletConfig)} when initializing the subsystems and can be * overridden for custom restrictor creation. * * @param pLocation location to lookup the restrictor * @return the restrictor to use. */ protected Restrictor createRestrictor(String pLocation) { LogHandler log = getLogHandler(); try { Restrictor newRestrictor = RestrictorFactory.lookupPolicyRestrictor(pLocation); if (newRestrictor != null) { log.info("Using access restrictor " + pLocation); return newRestrictor; } else { log.info( "No access restrictor found at " + pLocation + ", access to all MBeans is allowed"); return new AllowAllRestrictor(); } } catch (IOException e) { log.error( "Error while accessing access restrictor at " + pLocation + ". Denying all access to MBeans for security reasons. Exception: " + e, e); return new DenyAllRestrictor(); } }
// Final private error log for use in the constructor above private void intError(String message, Throwable t) { logHandler.error(message, t); debugStore.log(message, t); }