<commit_before>package net.sensnet.node;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.logging.StreamHandler;

public class DatabaseConnection {
    private Connection connection;
    private static SensNetNodeConfiguration config;
    private HashMap<String, PreparedStatement> statements = new HashMap<String, PreparedStatement>();
    private long lastAction = System.currentTimeMillis();
    private Statement adHoc;
    private static final int CONNECTION_TIMEOUT = 24 * 60 * 60;

    private static final Logger l;
    static {
        Logger l1 = Logger.getLogger(DatabaseConnection.class.getName());
        l1.setUseParentHandlers(false);
        OutputStream out;
        try {
            out = new FileOutputStream("dbconn.log");
            l1.addHandler(new StreamHandler(out, new SimpleFormatter()));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        l = l1;
    }

    public DatabaseConnection() {
        l.info("New connection for " + Thread.currentThread().getId());
        try {
            Class.forName(config.getJDBCDriver());
        } catch (ClassNotFoundException e) {
            System.err.println("Error loading database driver!");
            e.printStackTrace();
            l.log(Level.SEVERE, "Error while loading driver", e);
        }
        tryConnect();
    }

    public static void init(SensNetNodeConfiguration conf) {
        config = conf;
    }

    public Connection getConnection() {
        return connection;
    }<commit_msg>[DEBUG] fix: flush file-based logger for db connection.<commit_after>package net.sensnet.node;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.logging.StreamHandler;

public class DatabaseConnection {
    private Connection connection;
    private static SensNetNodeConfiguration config;
    private HashMap<String, PreparedStatement> statements = new HashMap<String, PreparedStatement>();
    private long lastAction = System.currentTimeMillis();
    private Statement adHoc;
    private static final int CONNECTION_TIMEOUT = 24 * 60 * 60;

    private static final Logger l;
    static {
        Logger l1 = Logger.getLogger(DatabaseConnection.class.getName());
        l1.setUseParentHandlers(false);
        OutputStream out;
        try {
            FileHandler fh = new FileHandler("dbconn.log");
            fh.setFormatter(new SimpleFormatter());
            l1.addHandler(fh);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        l = l1;
    }

    public DatabaseConnection() {
        l.info("New connection for " + Thread.currentThread().getId());
        try {
            Class.forName(config.getJDBCDriver());
        } catch (ClassNotFoundException e) {
            System.err.println("Error loading database driver!");
            e.printStackTrace();
            l.log(Level.SEVERE, "Error while loading driver", e);
        }
        tryConnect();
    }

    public static void init(SensNetNodeConfiguration conf) {
        config = conf;
    }

    public Connection getConnection() {
        return connection;
    }
{'fraction_non_alphanumeric': 0.09779889944972486, 'fraction_numerical': 0.0050025012506253125, 'mean_word_length': 3.0516717325227964, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4219947', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1036, 'n_words': 261}