franta-hg@55: /** franta-hg@55: * SQL-DK franta-hg@55: * Copyright © 2013 František Kučera (frantovo.cz) franta-hg@55: * franta-hg@55: * This program is free software: you can redistribute it and/or modify franta-hg@55: * it under the terms of the GNU General Public License as published by franta-hg@55: * the Free Software Foundation, either version 3 of the License, or franta-hg@55: * (at your option) any later version. franta-hg@55: * franta-hg@55: * This program is distributed in the hope that it will be useful, franta-hg@55: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@55: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@55: * GNU General Public License for more details. franta-hg@55: * franta-hg@55: * You should have received a copy of the GNU General Public License franta-hg@55: * along with this program. If not, see . franta-hg@55: */ franta-hg@55: package info.globalcode.sql.dk.logging; franta-hg@55: franta-hg@55: import info.globalcode.sql.dk.Constants; franta-hg@55: import java.util.logging.ConsoleHandler; franta-hg@55: import java.util.logging.Level; franta-hg@55: import java.util.logging.Logger; franta-hg@55: franta-hg@55: /** franta-hg@55: * Configures logging subsystem. franta-hg@55: * Usage: java -Djava.util.logging.config.class=info.globalcode.sql.dk.logging.LoggerInitializer … franta-hg@55: * franta-hg@55: * @author Ing. František Kučera (frantovo.cz) franta-hg@55: */ franta-hg@55: public class LoggerInitializer { franta-hg@55: franta-hg@55: public LoggerInitializer() { franta-hg@55: Logger logger = Logger.getLogger(Constants.JAVA_PACKAGE); franta-hg@55: ConsoleHandler handler = new ConsoleHandler(); franta-hg@55: ColorfulConsoleFormatter formatter = new ColorfulConsoleFormatter(); franta-hg@55: franta-hg@55: logger.addHandler(handler); franta-hg@55: handler.setFormatter(formatter); franta-hg@55: franta-hg@57: handler.setLevel(Level.INFO); franta-hg@57: logger.setLevel(Level.INFO); franta-hg@55: franta-hg@55: franta-hg@55: /** franta-hg@55: * TODO: FileHandler – detailed logs in file in ~/sql-dk/log/… franta-hg@55: */ franta-hg@55: } franta-hg@55: }