@Override public void setThreshold(Level l) { if (l != null) { jblmRootLogger.setLevel(JBossLevelMapping.getLevelFor(l)); } }
public void setLevel(Level level) { synchronized (LEVEL_LOCK) { jblmLogger.setLevel(JBossLevelMapping.getLevelFor(level)); this.level = level; } }
@Override public Object run() { jblmLogger.setLevel(JBossLevelMapping.getLevelFor(level)); return null; } });
@Deprecated public void setPriority(final Priority priority) { logger.setLevel(LevelMapping.getLevelFor(priority)); }
public void applyPostCreate(final Level param) { configuration.getLoggerRefs().get(getName()).setLevel(param); }
/** * Set the log level by name. Uses the parent logging context's name registry; otherwise behaves * identically to {@link #setLevel(Level)}. * * @param newLevelName the name of the level to set * @throws SecurityException if a security manager exists and if the caller does not have LoggingPermission("control") */ public void setLevelName(String newLevelName) throws SecurityException { setLevel(loggerNode.getContext().getLevelForName(newLevelName)); }
public void applyPostCreate(final Void param) { if (refLogger != null) { refLogger.setFilter(null); refLogger.clearHandlers(); refLogger.setLevel(null); refLogger.setUseParentHandlers(true); } }
@SuppressWarnings({"unchecked"}) public void rollback() { if (refLogger != null) { refLogger.setFilter(filter); if (handlers != null) refLogger.setHandlers(handlers); refLogger.setLevel(level); refLogger.setUseParentHandlers(useParentHandlers); configs.put(name, LoggerConfigurationImpl.this); } clearRemoved(); } };
public Hierarchy(Logger root) { listeners = new CopyOnWriteArraySet<HierarchyEventListener>(); jblmRootLogger = JBossLogManagerFacade.getJBossLogger(JBossLogManagerFacade.JBL_ROOT_NAME); jblmRootLogger.setLevel(JBossLevelMapping.getLevelFor(root.getLevel())); defaultFactory = new DefaultCategoryFactory(); rendererMap = new RendererMap(); }
public final Level getLevel() { synchronized (LEVEL_LOCK) { if (level != null) { // Check to see if the level was changed on the JBoss LogManger logger and set to match the current level final Level currentLevel = JBossLevelMapping.getPriorityFor(jblmLogger.getLevel()); if (currentLevel.toInt() != level.toInt()) { // It's likely this shouldn't happen, but to be safe we should run in a privilege block if (System.getSecurityManager() == null) { jblmLogger.setLevel(JBossLevelMapping.getLevelFor(level)); } else { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { jblmLogger.setLevel(JBossLevelMapping.getLevelFor(level)); return null; } }); } } } } return level; }
@Test public void testMultipleConcurrentDurableSubscribers() throws Exception { org.jboss.logmanager.Logger.getLogger(StompConnection.class.getName()).setLevel(org.jboss.logmanager.Level.TRACE); int NUMBER_OF_THREADS = 25; SubscriberThread[] threads = new SubscriberThread[NUMBER_OF_THREADS]; final CountDownLatch startFlag = new CountDownLatch(1); final CountDownLatch alignFlag = new CountDownLatch(NUMBER_OF_THREADS); for (int i = 0; i < threads.length; i++) { threads[i] = new SubscriberThread("subscriber::" + i, StompClientConnectionFactory.createClientConnection(uri), startFlag, alignFlag); } for (SubscriberThread t : threads) { t.start(); } alignFlag.await(); startFlag.countDown(); for (SubscriberThread t : threads) { t.join(); Assert.assertEquals(0, t.errors.get()); } }
@Test public void testMultipleDurableSubscribers() throws Exception { org.jboss.logmanager.Logger.getLogger(StompConnection.class.getName()).setLevel(org.jboss.logmanager.Level.TRACE); conn.connect(defUser, defPass, "myClientID"); StompClientConnectionV12 conn2 = (StompClientConnectionV12) StompClientConnectionFactory.createClientConnection(uri); conn2.connect(defUser, defPass, "myClientID"); subscribe(conn, UUID.randomUUID().toString(), "client-individual", getName()); subscribe(conn2, UUID.randomUUID().toString(), "clientindividual", getName()); conn.closeTransport(); waitDisconnect(conn); conn2.closeTransport(); waitDisconnect(conn2); }
private static void clearLogContext() { // Remove the configurator and clear the log context final Configurator configurator = EMBEDDED_LOG_CONTEXT.getLogger("").detach(Configurator.ATTACHMENT_KEY); // If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext if (configurator instanceof PropertyConfigurator) { final LogContextConfiguration logContextConfiguration = ((PropertyConfigurator) configurator).getLogContextConfiguration(); clearLogContext(logContextConfiguration); } else if (configurator instanceof LogContextConfiguration) { clearLogContext((LogContextConfiguration) configurator); } else { // Remove all the handlers and close them as well as reset the loggers final List<String> loggerNames = Collections.list(EMBEDDED_LOG_CONTEXT.getLoggerNames()); for (String name : loggerNames) { final Logger logger = EMBEDDED_LOG_CONTEXT.getLoggerIfExists(name); if (logger != null) { final Handler[] handlers = logger.clearHandlers(); if (handlers != null) { for (Handler handler : handlers) { handler.close(); } } logger.setFilter(null); logger.setUseParentFilters(false); logger.setUseParentHandlers(true); logger.setLevel(Level.INFO); } } } }
private static void clearLogContext() { // Remove the configurator and clear the log context final Configurator configurator = EMBEDDED_LOG_CONTEXT.getLogger("").detach(Configurator.ATTACHMENT_KEY); // If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext if (configurator instanceof PropertyConfigurator) { final LogContextConfiguration logContextConfiguration = ((PropertyConfigurator) configurator).getLogContextConfiguration(); clearLogContext(logContextConfiguration); } else if (configurator instanceof LogContextConfiguration) { clearLogContext((LogContextConfiguration) configurator); } else { // Remove all the handlers and close them as well as reset the loggers final List<String> loggerNames = Collections.list(EMBEDDED_LOG_CONTEXT.getLoggerNames()); for (String name : loggerNames) { final Logger logger = EMBEDDED_LOG_CONTEXT.getLoggerIfExists(name); if (logger != null) { final Handler[] handlers = logger.clearHandlers(); if (handlers != null) { for (Handler handler : handlers) { handler.close(); } } logger.setFilter(null); logger.setUseParentFilters(false); logger.setUseParentHandlers(true); logger.setLevel(Level.INFO); } } } }
logger.setUseParentFilters(false); logger.setUseParentHandlers(true); logger.setLevel(Level.INFO);
logger.setUseParentFilters(false); logger.setUseParentHandlers(true); logger.setLevel(Level.INFO);
@Test public void testBasicPluginAuthorization() throws Exception { org.jboss.logmanager.Logger.getLogger(LDAPLoginModule.class.getName()).setLevel(org.jboss.logmanager.Level.DEBUG); org.jboss.logmanager.Logger.getLogger(LegacyLDAPSecuritySettingPlugin.class.getName()).setLevel(org.jboss.logmanager.Level.DEBUG); server.start(); ClientSessionFactory cf = locator.createSessionFactory(); String name = "TEST.FOO"; try { ClientSession session = cf.createSession("admin", "secret", false, true, true, false, 0); session.createQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name)); ClientProducer producer = session.createProducer(); producer.send(name, session.createMessage(false)); session.close(); } catch (ActiveMQException e) { e.printStackTrace(); Assert.fail("should not throw exception"); } cf.close(); } }