use of java.util.logging.Handler in project adempiere by adempiere.
the class CLogMgt method setLevel.
// setLoggerLevel
/**
* Set Level for all handlers
* @param level log level
*/
public static void setLevel(Level level) {
if (level == null)
return;
if (s_handlers == null)
initialize(true);
//
for (int i = 0; i < s_handlers.size(); i++) {
Handler handler = (Handler) s_handlers.get(i);
handler.setLevel(level);
}
// JDBC if ALL
setJDBCDebug(s_currentLevel.intValue() == Level.ALL.intValue());
//
if (level.intValue() != s_currentLevel.intValue()) {
setLoggerLevel(level, null);
log.config(level.toString());
}
s_currentLevel = level;
}
use of java.util.logging.Handler in project adempiere by adempiere.
the class SilentSetup method main.
/**
* Start
* @param args Log Level e.g. ALL, FINE
*/
public static void main(String[] args) {
CLogMgt.initialize(true);
Handler fileHandler = new CLogFile(System.getProperty("user.dir"), false, false);
CLogMgt.addHandler(fileHandler);
// Log Level
if (args.length > 0)
CLogMgt.setLevel(args[0]);
else
CLogMgt.setLevel(Level.INFO);
// File Logger at least FINE
if (fileHandler.getLevel().intValue() > Level.FINE.intValue())
fileHandler.setLevel(Level.FINE);
new SilentSetup();
}
use of java.util.logging.Handler in project geode by apache.
the class GfshInitFileJUnitTest method setUpBeforeClass.
/*
* Turn off console logging from JUL and Log4j2 for the duration of this class's tests, to reduce
* noise level of output in automated build.
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
saveLog4j2Config = System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
julLogger = java.util.logging.Logger.getLogger("");
saveHandlers = julLogger.getHandlers();
for (Handler handler : saveHandlers) {
julLogger.removeHandler(handler);
}
File log4j2XML = temporaryFolder_Config.newFile("log4j2.xml");
FileUtils.writeStringToFile(log4j2XML, "<Configuration/>", APPEND);
System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, log4j2XML.toURI().toString());
}
use of java.util.logging.Handler in project gfm_viewer by satyagraha.
the class SimpleLogging method setupLogging.
public static void setupLogging() {
if (isDebugging()) {
Logger rootLogger = Logger.getLogger("");
for (Handler handler : rootLogger.getHandlers()) {
handler.setLevel(Level.FINE);
}
// Set root logger level
rootLogger.setLevel(Level.FINE);
}
}
use of java.util.logging.Handler in project google-cloud-java by GoogleCloudPlatform.
the class LoggingHandlerTest method testClose.
@Test
public void testClose() throws Exception {
expect(options.getProjectId()).andReturn(PROJECT).anyTimes();
expect(options.getService()).andReturn(logging);
logging.setFlushSeverity(Severity.ERROR);
expectLastCall().once();
logging.setWriteSynchronicity(Synchronicity.ASYNC);
expectLastCall().once();
logging.write(ImmutableList.of(FINEST_ENTRY), DEFAULT_OPTIONS);
expectLastCall().once();
logging.close();
expectLastCall().once();
replay(options, logging);
Handler handler = new LoggingHandler(LOG_NAME, options);
handler.setLevel(Level.ALL);
handler.setFormatter(new TestFormatter());
handler.publish(newLogRecord(Level.FINEST, MESSAGE));
handler.close();
handler.close();
}
Aggregations