@Override public String getLogger () { return log != null ? log.getLogger().getName() : null; }
protected boolean isLevelEnabled(int logLevel) { Logger logger = log.getLogger(); Configuration cfg = logger.getConfiguration(); if (cfg == null) cfg = new SimpleConfiguration(); String levelString = cfg.get("slf4j.level", System.getProperty("slf4j.level")); int currentLogLevel = levelString != null ? stringToLevel(levelString) : DEFAULT_LOG_LEVEL; return (logLevel >= currentLogLevel); }
private void initKS() throws Exception { ks = new SimpleKeyFile("build/resources/test/org/jpos/security/keys-test"); ((LogSource) ks).setLogger(log.getLogger(), "KS"); }
private void initSM() throws ConfigurationException { sm = new JCESecurityModule(); sm.setLogger(log.getLogger(), "SSM"); Properties props = new Properties(); props.put("lmk", "build/resources/test/org/jpos/security/lmk-test"); props.put("provider", "com.sun.crypto.provider.SunJCE"); sm.setConfiguration(new SimpleConfiguration(props)); }
pool.setLogger (log.getLogger(), getName() + ".pool"); server.setLogger (log.getLogger(), getName() + ".server"); server.setName (getName ()); if (socketFactoryString != null) { ISOServerSocketFactory sFac = (ISOServerSocketFactory) getFactory().newInstance(socketFactoryString); if (sFac != null && sFac instanceof LogSource) { ((LogSource) sFac).setLogger(log.getLogger(),getName() + ".socket-factory");
@Test public void testGetLogger() throws Throwable { Logger logger = new Logger(); Log bSHRequestListener = new BSHRequestListener(); bSHRequestListener.setLogger(logger, "testLogRealm"); Logger result = bSHRequestListener.getLogger(); assertSame("result", logger, result); }
public void initChannel () throws ConfigurationException { Element persist = getPersist (); Element e = persist.getChild ("channel"); if (e == null) throw new ConfigurationException ("channel element missing"); channel = newChannel (e, getFactory()); String socketFactoryString = getSocketFactory(); if (socketFactoryString != null && channel instanceof FactoryChannel) { ISOClientSocketFactory sFac = (ISOClientSocketFactory) getFactory().newInstance(socketFactoryString); if (sFac != null && sFac instanceof LogSource) { ((LogSource) sFac).setLogger(log.getLogger(),getName() + ".socket-factory"); } getFactory().setConfiguration (sFac, e); ((FactoryChannel)channel).setSocketFactory(sFac); } } private ISOChannel newChannel (Element e, QFactory f)
protected ISOChannel initChannel () throws ConfigurationException { Element persist = getPersist (); Element e = persist.getChild ("channel"); if (e == null) throw new ConfigurationException ("channel element missing"); ISOChannel c = newChannel (e, getFactory()); String socketFactoryString = getSocketFactory(); if (socketFactoryString != null && c instanceof FactoryChannel) { ISOClientSocketFactory sFac = (ISOClientSocketFactory) getFactory().newInstance(socketFactoryString); if (sFac != null && sFac instanceof LogSource) { ((LogSource) sFac).setLogger(log.getLogger(),getName() + ".socket-factory"); } getFactory().setConfiguration (sFac, e); ((FactoryChannel)c).setSocketFactory(sFac); } return c; } protected void initSpaceAndQueues () throws ConfigurationException {
public void initService() throws ConfigurationException { Space sp = SpaceFactory.getSpace (cfg.get ("space", "")); rspaceUri = cfg.get ("rspace", "rspace"); try { rs = new ReplicatedSpace ( sp, cfg.get ("group", "rspace"), cfg.get ("config", "cfg.jgroups.xml"), getLog().getLogger(), getLog().getRealm(), cfg.getBoolean ("trace"), cfg.getBoolean ("replicate", false) ); NameRegistrar.register (rspaceUri, rs); } catch (Throwable t) { throw new ConfigurationException (t); } } protected void stopService () throws Exception {
protected void initService () throws Exception { QFactory factory = getServer().getFactory(); dirPoll = createDirPoll(); dirPoll.setPath (getPath ()); dirPoll.setThreadPool (new ThreadPool (1, poolSize)); dirPoll.setPollInterval (pollInterval); if (priorities != null) dirPoll.setPriorities (priorities); dirPoll.setLogger (getLog().getLogger(), getLog().getRealm ()); Configuration cfg = factory.getConfiguration (getPersist()); dirPoll.setConfiguration (cfg); dirPoll.createDirs (); Object dpp = factory.newInstance (getProcessor()); if (dpp instanceof LogSource) { ((LogSource) dpp).setLogger ( getLog().getLogger(), getLog().getRealm () ); } if (dpp instanceof Configurable) { ((Configurable) dpp).setConfiguration (cfg); } dirPoll.setProcessor (dpp); }
if (sFac != null && sFac instanceof LogSource) ((LogSource) sFac).setLogger(log.getLogger(), getName() + ".socket-factory");