use of org.pmw.tinylog.writers.RollingFileWriter in project openpnp by openpnp.
the class Main method configureLogging.
private static void configureLogging(File configurationDirectory) {
File logDirectory = new File(configurationDirectory, "log");
File logFile = new File(logDirectory, "OpenPnP.log");
Configurator.currentConfig().writer(new RollingFileWriter(logFile.getAbsolutePath(), 100)).addWriter(new ConsoleWriter(System.out, System.err)).activate();
Configurator.currentConfig().formatPattern("{date:yyyy-MM-dd HH:mm:ss.SSS} {class_name} {level}: {message}").activate();
// Redirect the stdout and stderr to the LogPanel
SystemLogger out = new SystemLogger(System.out, Level.INFO);
SystemLogger err = new SystemLogger(System.err, Level.ERROR);
System.setOut(out);
System.setErr(err);
}
use of org.pmw.tinylog.writers.RollingFileWriter in project liferay-imex by jpdacunha.
the class ImexExecutionReportServiceImpl method initializeLogger.
private void initializeLogger(String logsPath) {
if (configurator == null) {
_log.debug("Initializing logger ...");
configurator = Configurator.defaultConfig();
configurator.level(Level.DEBUG);
configurator.formatPattern("{date:yyyy-MM-dd HH:mm:ss} {level} [{thread}] [{context:" + ImexExecutionReportService.IDENTIFIER_KEY + "}] : {message}");
if (_log.isDebugEnabled()) {
_log.debug("IMEX output log path : " + logsPath);
}
RollingFileWriter writer = new RollingFileWriter(logsPath + "/" + LOG_FILE_NAME, 3, new TimestampLabeler("yyyy-MM-dd"), new DailyPolicy());
configurator.addWriter(writer);
configurator.activate();
_log.debug("Done.");
}
if (this.displayInLiferayLogs == null) {
ImexProperties coreConfig = new ImexProperties();
configurationService.loadCoreConfiguration(coreConfig);
this.displayInLiferayLogs = GetterUtil.getBoolean(coreConfig.getProperties().get(ImExCorePropsKeys.DISPLAY_EXECUTION_IN_LIFERAY_LOGS));
}
}
use of org.pmw.tinylog.writers.RollingFileWriter in project trackworktime by mathisdt.
the class Basics method initTinyLog.
public void initTinyLog() {
String threadToObserve = Thread.currentThread().getName();
Configurator.defaultConfig().writer(new RollingFileWriter(getCurrentLogFile().getPath(), 2, false, new CountLabeler(), new DailyPolicy()), Level.DEBUG, "{date:yyyy-MM-dd HH:mm:ss} {{level}|min-size=5} {class_name}.{method} - {message}").addWriter(new LogcatWriter("trackworktime"), Level.DEBUG, "{message}").writingThread(threadToObserve, 1).activate();
Logger.info("logger initialized - writing thread observes \"{}\"", threadToObserve);
}
Aggregations