Usages of

java.util.logging.Logger.addHandler(?)
public static void initLog(Object instance, String filefullpath, Logger theLogger) throws SecurityException, IOException{ //creating instance logger FileHandler theFileHandler = new FileHandler(filefullpath, false); theFileHandler.setFormatter(new LogFormatter()); theFileHandler.setFilter(new InstanceFilter(instance)); theLogger.addHandler(theFileHandler); }
@Override protected JulListAppender createAppender(Appender logs) { JulListAppender appender = new JulListAppender(logs); final Logger rootLogger = JulLoggerFacade.getRootLogger(); rootLogger.setLevel(Level.ALL); rootLogger.addHandler(appender); return appender; }
@BeforeClass public static final void setLogging() { Handler ch = new StreamHandler(System.out, new SimpleFormatter()) ; ch.setLevel(Level.ALL); Logger logger = Logger.getLogger("net.tuis"); logger.setLevel(Level.FINEST); logger.addHandler(ch); }
private static final Logger LOGGER = Logger.getLogger(ManagedSEDeployableContainer.class.getName()); // code omitted ... private void configureLogging(ManagedSEContainerConfiguration configuration) { ConsoleHandler consoleHandler = new ConsoleHandler(); consoleHandler.setLevel(configuration.getLogLevel()); LOGGER.setUseParentHandlers(false); LOGGER.addHandler(consoleHandler); LOGGER.setLevel(configuration.getLogLevel()); }
private Logger m_logger = Logger.getLogger(this.getClass().getName()); // code omitted ... public SocketPublisher() { m_logger.setUseParentHandlers(false); ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.WARNING); m_logger.addHandler(handler); m_logger.setLevel(Level.WARNING); }
public static final Logger deplLogger = org.glassfish.deployment.common.DeploymentContextImpl.deplLogger; // code omitted ... @BeforeClass public static void setUpClass() throws Exception { habitat = Utils.getNewHabitat(); archiveFactory = habitat.getService(ArchiveFactory.class); handler = new RecordingHandler(); memoryHandler = new MemoryHandler(handler, 10, Level.ALL); deplLogger.addHandler(handler); }
public static void setUpLogger(Logger log, File logFile, boolean append) throws SecurityException, IOException { FileHandler fh = new FileHandler(logFile.getAbsolutePath(), append); log.addHandler(fh); log.setLevel(Level.ALL); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); }
public final static Logger logger = Logger.getLogger("LoggerUtil"); // code omitted ... public void init_logger(String pattern, int limit, int count, boolean append) throws IOException { FileHandler handler = new FileHandler(pattern, limit, count, append); handler.setFormatter(new SimpleFormatter());//������������ logger.addHandler(handler);//������������������ }
protected void setUp() throws Exception { super.setUp(); Logger logger = Logger.getLogger("TEST"); mockHandler = new MockHandler(); removeHandlers(logger); logger.addHandler(mockHandler); }
public static final Logger getLogger(Class<?> the_class) { Logger logger = Logger.getLogger(the_class.getName()); logger.setLevel(LOG_LEVEL); ConsoleHandler console_handler = new ConsoleHandler(); logger.addHandler(console_handler); // try { // FileHandler log_file_handler = new FileHandler("log.txt", true); // logger.addHandler(log_file_handler); // } catch (SecurityException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } return logger; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes