use of java.util.logging.SimpleFormatter in project jgnash by ccavanaugh.
the class OfxV2Parser method enableDetailedLogFile.
static void enableDetailedLogFile() {
try {
final Handler fh = new FileHandler("%h/jgnash-ofx.log", false);
fh.setFormatter(new SimpleFormatter());
logger.addHandler(fh);
logger.setLevel(Level.ALL);
} catch (final IOException ioe) {
logger.severe(ResourceUtils.getString("Message.Error.LogFileHandler"));
}
}
use of java.util.logging.SimpleFormatter in project pyramid by cheng-li.
the class App3 method main.
public static void main(String[] args) throws Exception {
if (args.length != 1) {
throw new IllegalArgumentException("Please specify a properties file.");
}
Config config = new Config(args[0]);
Logger logger = Logger.getAnonymousLogger();
String logFile = config.getString("output.log");
FileHandler fileHandler = null;
if (!logFile.isEmpty()) {
new File(logFile).getParentFile().mkdirs();
//todo should append?
fileHandler = new FileHandler(logFile, true);
java.util.logging.Formatter formatter = new SimpleFormatter();
fileHandler.setFormatter(formatter);
logger.addHandler(fileHandler);
logger.setUseParentHandlers(false);
}
logger.info(config.toString());
if (fileHandler != null) {
fileHandler.close();
}
File output = new File(config.getString("output.folder"));
output.mkdirs();
Config app1Config = createApp1Config(config);
Config app2Config = createApp2Config(config);
App1.main(app1Config);
App2.main(app2Config);
}
Aggregations