org.pmw.tinylog.Level Java Examples

The following examples show how to use org.pmw.tinylog.Level. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CassandraStatement.java    From cassandra-jdbc-driver with Apache License 2.0 6 votes vote down vote up
protected void postStatementExecution(CassandraCqlStatement parsedStmt, ResultSet rs) {
    if (LOG_LEVEL.compareTo(Level.DEBUG) >= 0 && rs != null) {
        List<ExecutionInfo> list = rs.getAllExecutionInfo();
        int size = list == null ? 0 : list.size();

        if (size > 0) {
            int index = 1;

            for (ExecutionInfo info : rs.getAllExecutionInfo()) {
                Logger.debug(getExecutionInfoAsString(info, index, size));

                QueryTrace q = info.getQueryTrace();
                if (parsedStmt.getConfiguration().tracingEnabled() && q != null) {
                    Logger.debug(getQueryTraceAsString(q, index, size));
                }

                index++;
            }

            Logger.debug("Executed successfully with results: {}", !rs.isExhausted());
        }
    }

    replaceCurrentResultSet(parsedStmt, rs);
}
 
Example #2
Source File: DummyCassandraResultSet.java    From cassandra-jdbc-driver with Apache License 2.0 6 votes vote down vote up
/**
 * This creates a result set based on given data and column definitions.
 *
 * @param columns column definitions, name and its Cql type
 * @param data    rows
 */
public DummyCassandraResultSet(String[][] columns, Object[][] data) {
    super(null, null);

    Logger.trace("Constructing dummy result set @{}...", hashCode());

    if (columns != null && columns.length > 0 && columns[0].length > 1) {
        for (String[] column : columns) {
            Logger.trace("* Column: {name={}, cqlType={}}", column[0], column[1]);

            metadata.addColumnDefinition(new CassandraColumnDefinition(
                    null, null, column[0], column[1], false));
        }
    }

    this.data = data == null ? new String[0][] : data;

    if (LOG_LEVEL.compareTo(Level.TRACE) >= 0) {
        for (Object[] row : this.data) {
            Logger.trace("* Row: {}", Arrays.toString(row));
        }
    }

    Logger.trace("Dummy result set @{} is ready for use", hashCode());
}
 
Example #3
Source File: Basics.java    From trackworktime with GNU General Public License v3.0 6 votes vote down vote up
private void init() {
	preferences = PreferenceManager.getDefaultSharedPreferences(context);
	dao = new DAO(context);
	timerManager = new TimerManager(dao, preferences, context);
	timeCalculator = new TimeCalculator(dao, timerManager);
	externalNotificationManager = new ExternalNotificationManager(context);

	// init TinyLog
	String threadToObserve = Thread.currentThread().getName();
	Configurator.defaultConfig()
		.writer(new RollingFileWriter(getDataDirectory().getAbsolutePath() + File.separatorChar + Constants.CURRENT_LOG_FILE_NAME,
				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);

	registerThirdPartyReceiver();
}
 
Example #4
Source File: KanelaConfiguration.java    From kanela with Apache License 2.0 5 votes vote down vote up
private Level getLoggerLevel(Config config) {
    val level = Try.of(() -> config.getString("log-level")).getOrElse("INFO");
    return Match(level).of(
            Case($("INFO"), Level.INFO),
            Case($("DEBUG"), Level.DEBUG),
            Case($("ERROR"), Level.ERROR),
            Case($("WARNING"), Level.WARNING),
            Case($("TRACE"), Level.TRACE),
            Case($("OFF"), Level.OFF)
        );
}