Java Code Examples for java.util.logging.Logger#config()
The following examples show how to use
java.util.logging.Logger#config() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestIsLoggable.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 2
Source File: TestIsLoggable.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 3
Source File: TestIsLoggable.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 4
Source File: TestIsLoggable.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 5
Source File: TestIsLoggable.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 6
Source File: TestIsLoggable.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 7
Source File: TestIsLoggable.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 8
Source File: TestIsLoggable.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 9
Source File: LogLevelTest.java From appengine-tck with Apache License 2.0 | 6 votes |
@Test public void testLogLevelInAppLogLineMatchesActualLogLevelUsedWhenLogging() { Logger log = Logger.getLogger(LogLevelTest.class.getName()); log.finest("finest_testLogLevelMatches"); log.finer("finer_testLogLevelMatches"); log.fine("fine_testLogLevelMatches"); log.config("config_testLogLevelMatches"); log.info("info_testLogLevelMatches"); log.warning("warning_testLogLevelMatches"); log.severe("severe_testLogLevelMatches"); flush(log); assertLogContains("finest_testLogLevelMatches", LogService.LogLevel.DEBUG); assertLogContains("finer_testLogLevelMatches", LogService.LogLevel.DEBUG); assertLogContains("fine_testLogLevelMatches", LogService.LogLevel.DEBUG); assertLogContains("config_testLogLevelMatches", LogService.LogLevel.DEBUG); // we can't test the following on dev appserver, because it returns incorrect logLevels // more info at http://code.google.com/p/googleappengine/issues/detail?id=8651 //TODO:Renable after project compiles and runs. // assertLogContains("info_testLogLevelMatches", LogService.LogLevel.INFO); // assertLogContains("warning_testLogLevelMatches", LogService.LogLevel.WARN); // assertLogContains("severe_testLogLevelMatches", LogService.LogLevel.ERROR); }
Example 10
Source File: TestIsLoggable.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 11
Source File: TestIsLoggable.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 12
Source File: TestIsLoggable.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void loglevel(Level l, Logger logger, String message) { LogTest test = LogTest.valueOf("LEV_"+l.getName()); switch(test) { case LEV_SEVERE: logger.severe(message); break; case LEV_WARNING: logger.warning(message); break; case LEV_INFO: logger.info(message); break; case LEV_CONFIG: logger.config(message); break; case LEV_FINE: logger.fine(message); break; case LEV_FINER: logger.finer(message); break; case LEV_FINEST: logger.finest(message); break; } }
Example 13
Source File: RestletThread.java From vicinity-gateway-api with GNU General Public License v3.0 | 5 votes |
/** * Constructor, initialises the configuration and logger instances. * * @param config OGWAPI configuration. * @param logger OGWAPI Logger. */ public RestletThread(XMLConfiguration config, Logger logger, MessageCounter messageCounter){ this.config = config; this.logger = logger; this.messageCounter = messageCounter; threadRunning = true; enableHttps = config.getBoolean(CONF_PARAM_APIENABLEHTTPS, CONF_DEF_APIENABLEHTTPS); if (enableHttps) { logger.config("HTTPS enabled."); keystoreFile = config.getString(CONF_PARAM_KEYSTOREFILE, CONF_DEF_KEYSTOREFILE); logger.config("Path to keystore file: " + keystoreFile); keystorePassword = config.getString(CONF_PARAM_KEYSTOREPASSWORD, CONF_DEF_KEYSTOREPASSWORD); keyPassword = config.getString(CONF_PARAM_KEYPASSWORD, CONF_DEF_KEYPASSWORD); keystoreType = config.getString(CONF_PARAM_KEYSTORETYPE, CONF_DEF_KEYSTORETYPE); logger.config("Keystore type is " + keystoreType); } else { logger.config("HTTPS disabled."); } port = config.getInt(CONF_PARAM_APIPORT, CONF_DEF_APIPORT); logger.config("Set to listen on port " + port); }
Example 14
Source File: AbstractLoggerTest.java From logging-log4j2 with Apache License 2.0 | 5 votes |
private void testMessage(final String string) { final Logger root = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); root.info("Test info " + string); root.config("Test info " + string); root.fine("Test info " + string); final List<LogEvent> events = eventAppender.getEvents(); assertThat(events, hasSize(3)); for (final LogEvent event : events) { final String message = event.getMessage().getFormattedMessage(); assertThat(message, equalTo("Test info " + string)); } }
Example 15
Source File: JMonkeyEngineTest.java From Bytecoder with Apache License 2.0 | 5 votes |
@Test public void testLogger() { final Logger logger = Logger.getLogger("Testlogger"); logger.setLevel(Level.INFO); logger.config("config"); logger.fine("fine"); logger.finer("finer"); logger.finest("finest"); logger.info("info"); logger.severe("severe"); logger.warning("warning"); }
Example 16
Source File: AbstractLoggerTest.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Test public void testLogWithCallingClass() throws Exception { final Logger log = Logger.getLogger("Test.CallerClass"); log.config("Calling from LoggerTest"); final List<String> messages = stringAppender.getMessages(); assertThat(messages, hasSize(1)); final String message = messages.get(0); assertEquals(AbstractLoggerTest.class.getName(), message); }
Example 17
Source File: RestAgentConnector.java From vicinity-gateway-api with GNU General Public License v3.0 | 4 votes |
/** * Constructor. It is necessary to provide all parameters. If null is provided in place of any of them, * a storm of null pointer exceptions is imminent. * * @param config Configuration of the OGWAPI. * @param logger Logger of the OGWAPI. */ public RestAgentConnector(XMLConfiguration config, Logger logger){ super(config, logger); // load configuration for dummy connector if (config.getBoolean(CONFIG_PARAM_CONNECTORRESTDUMMY, CONFIG_DEF_APIRESTAGENTDUMMY)) { logger.config("REST Agent Connector: Dummy payloads enabled, all calls to an Agent via this connector " + "will be simulated."); dummyCalls = true; } else { logger.config("REST Agent Connector: Dummy payloads disabled, all calls to an Agent via this connector " + "will be real."); } // load configuration for https if (config.getBoolean(CONFIG_PARAM_CONNECTORRESTUSEHTTPS, CONFIG_DEF_APIAGENTUSEHTTPS)){ logger.config("REST Agent Connector: HTTPS protocol enabled for Agent communication."); useHttps = true; acceptSelfSigned = config.getBoolean(CONFIG_PARAM_HTTPSACCEPTSELFSIGNED, CONFIG_DEF_HTTPSACCEPTSELFSIGNED); } else { logger.config("REST Agent Connector: HTTPS protocol disabled for Agent communication."); useHttps = false; acceptSelfSigned = false; } // load authentication method agentAuthMethod = config.getString(CONFIG_PARAM_AUTHMETHOD, CONFIG_DEF_AUTHMETHOD); if (!agentAuthMethod.equals(CONFIG_DEF_AUTHMETHOD)) { // log it } agentUsername = config.getString(CONFIG_PARAM_AGENTUSERNAME, CONFIG_DEF_AGENTUSERNAME); agentPassword = config.getString(CONFIG_PARAM_AGENTPASSWORD, CONFIG_DEF_AGENTPASSWORD); // load timeout agentTimeout = config.getInt(CONFIG_PARAM_AGENTTIMEOUT, CONFIG_DEF_AGENTTIMEOUT); agentServiceUrl = assembleAgentServiceUrl(); // initialize CloseableHttpClient initialize(); }
Example 18
Source File: CommunicationManager.java From vicinity-gateway-api with GNU General Public License v3.0 | 4 votes |
/** * Constructor, initialises necessary objects. All parameters are mandatory, failure to include them can lead * to a swift end of application. * * @param config Configuration object. * @param logger Java logger. */ public CommunicationManager(XMLConfiguration config, Logger logger, MessageCounter messageCounter){ logger.config("OGWAPI version: " + OGWAPI_VERSION); this.descriptorPool = Collections.synchronizedMap(new HashMap<String, ConnectionDescriptor>()); this.nmConnector = new NeighbourhoodManagerConnector(config, logger); // load the configuration for the pageSize param pageSize = config.getInt(CONFIG_PARAM_PAGE_SIZE, CONFIG_DEF_PAGE_SIZE); this.sessionExpiration = 0; this.config = config; this.logger = logger; this.messageCounter = messageCounter; // load the configuration for the session recovery policy String sessionRecoveryPolicyString = config.getString(CONFIG_PARAM_SESSIONRECOVERY, CONFIG_DEF_SESSIONRECOVERY); translateSessionRecoveryConf(sessionRecoveryPolicyString); if (sessionRecoveryPolicy == SESSIONRECOVERYPOLICY_INT_ERROR) { // wrong configuration parameter entered - set it to default logger.warning("Wrong parameter entered for " + CONFIG_PARAM_SESSIONRECOVERY + " in the configuration file: " + sessionRecoveryPolicyString + ". Setting to default: " + CONFIG_DEF_SESSIONRECOVERY); translateSessionRecoveryConf(CONFIG_DEF_SESSIONRECOVERY); } else { logger.config("The session recovery policy is set to " + sessionRecoveryPolicyString + "."); } // timer for session checking - N/A if the session recovery is set to none if (sessionRecoveryPolicy != SESSIONRECOVERYPOLICY_INT_NONE) { int checkInterval; switch(sessionRecoveryPolicy) { case SESSIONRECOVERYPOLICY_INT_PASSIVE: checkInterval = SESSIONRECOVERY_CHECKINTERVAL_PASSIVE; sessionExpiration = config.getInt(CONFIG_PARAM_SESSIONEXPIRATION, CONFIG_DEF_SESSIONEXPIRATION); // if somebody put there too small number, we will turn it to default if (sessionExpiration < SESSIONEXPIRATION_MINIMAL_VALUE) { logger.warning("Wrong parameter entered for " + CONFIG_PARAM_SESSIONEXPIRATION + " in the configuration file: " + sessionRecoveryPolicyString + ". Setting to default: " + CONFIG_DEF_SESSIONEXPIRATION); sessionExpiration = CONFIG_DEF_SESSIONEXPIRATION; } sessionExpiration = sessionExpiration * 1000; logger.config("Session expiration is set to " + sessionExpiration + "ms"); break; case SESSIONRECOVERYPOLICY_INT_PROACTIVE: checkInterval = SESSIONRECOVERY_CHECKINTERVAL_PROACTIVE; break; default: // if something goes wrong, don't let the timer stand in our way checkInterval = Integer.MAX_VALUE; } Timer timerForSessionRecovery = new Timer(); timerForSessionRecovery.schedule(new TimerTask() { @Override public void run() { recoverSessions(); } }, checkInterval, checkInterval); } }
Example 19
Source File: TestInferCaller.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void test1(Logger logger) { System.out.println("test1: " + loggerName(logger)); AtomicInteger count = new AtomicInteger(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); logger.setLevel(Level.ALL); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); logger.severe("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); LogEvent event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); logger.warning("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); logger.info("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); logger.config("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); logger.fine("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); logger.finer("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); logger.finest("message " + count.incrementAndGet()); assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: "); event = TestHandler.PUBLISHED.remove(); assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: "); checkEvent(event, this.getClass().getName(), "test1", "message " + count.get()); }
Example 20
Source File: Action.java From vicinity-gateway-api with GNU General Public License v3.0 | 4 votes |
/** * Constructor, initialises field, loads configuration and starts timers. * * @param config Configuration of the OGWAPI. * @param objectId Object ID of the object that owns this instance of the action class. * @param actionId Action ID. * @param connector Instance of the {@link eu.bavenir.ogwapi.commons.connectors.AgentConnector AgentConnector}. * @param logger Logger of the OGWAPI. */ public Action(XMLConfiguration config, String objectId, String actionId, AgentConnector connector, Logger logger) { this.objectId = objectId; this.actionId = actionId; this.connector = connector; this.logger = logger; this.config = config; pendingTasks = Collections.synchronizedList(new LinkedList<Task>()); finishedTasks = Collections.synchronizedSet(new HashSet<Task>()); runningTask = null; // load configuration parameters timeToKeepReturnValues = // turn into ms config.getInt(CONF_PARAM_TIMETOKEEPRETURNVALUES, CONF_DEF_TIMETOKEEPRETURNVALUES) * MINUTE; logger.config("Action " + actionId + " time to keep return values set to (ms): " + timeToKeepReturnValues); pendingTaskTimeout = // turn into ms config.getInt(CONF_PARAM_PENDINGTASKTIMEOUT, CONF_DEF_PENDINGTASKTIMEOUT) * MINUTE; logger.config("Action " + actionId + " pending tasks timeout set to (ms): " + pendingTaskTimeout); maxNumberOfPendingTasks = config.getInt(CONF_PARAM_MAXNUMBEROFPENDINGTASKS, CONF_DEF_MAXNUMBEROFPENDINGTASKS); logger.config("Action " + actionId + " max number of pending tasks set to: " + maxNumberOfPendingTasks); // schedule a timer for running tasks that are queueing Timer timerForTaskScheduling = new Timer(); timerForTaskScheduling.schedule(new TimerTask() { @Override public void run() { workThroughTasks(); purgeOutdatedReturnValues(); purgeTimedOutPendingTasks(); } }, TIMER1_START, SECOND); }