<commit_before>package org.jboss.tools.vscode.java.handlers;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.util.Calendar;

import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.vscode.ipc.MessageType;
import org.jboss.tools.vscode.java.JavaClientConnection;

/**
 * The LogHandler hooks in the Eclipse log and forwards all Eclipse log messages to
 * the the client. In VSCode you can see all the messages in the Output view, in the
 * 'Java Language Support' channel.
 */
public class LogHandler {
	
	// if set, the all log entries will be written to USER_DIR/langserver.log as well.
	public static final boolean LOG_TO_FILE = true;
	
	private ILogListener logListener;
	private FileWriter logWriter;
	private DateFormat dateFormat;
	private int logLevelMask;
	private JavaClientConnection connection;
	private Calendar calendar;

	public void install(JavaClientConnection rcpConnection) {
	    this.dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
	    this.logLevelMask = getLogLevelMask(System.getProperty("log.level"));
	    this.calendar = Calendar.getInstance();
	    this.connection = rcpConnection;
		
		this.logListener = new ILogListener() {
			public void logging(IStatus status, String bundleId) {
				processLogMessage(status);
			}
		};
		Platform.addLogListener(this.logListener);
	}

	public void uninstall() {
		Platform.removeLogListener(this.logListener);
		if (this.logWriter != null) {
			try {
				this.logWriter.close();
			} catch (IOException e) {
				// ignore
			}
			this.logWriter = null;
		}
	}<commit_msg>Allow default value for log<commit_after>package org.jboss.tools.vscode.java.handlers;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.util.Calendar;

import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.vscode.ipc.MessageType;
import org.jboss.tools.vscode.java.JavaClientConnection;

/**
 * The LogHandler hooks in the Eclipse log and forwards all Eclipse log messages to
 * the the client. In VSCode you can see all the messages in the Output view, in the
 * 'Java Language Support' channel.
 */
public class LogHandler {
	
	// if set, the all log entries will be written to USER_DIR/langserver.log as well.
	public static final boolean LOG_TO_FILE = true;
	
	private ILogListener logListener;
	private FileWriter logWriter;
	private DateFormat dateFormat;
	private int logLevelMask;
	private JavaClientConnection connection;
	private Calendar calendar;

	public void install(JavaClientConnection rcpConnection) {
	    this.dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
	    this.logLevelMask = getLogLevelMask(System.getProperty("log.level", ""));//Empty by default
	    this.calendar = Calendar.getInstance();
	    this.connection = rcpConnection;
		
		this.logListener = new ILogListener() {
			public void logging(IStatus status, String bundleId) {
				processLogMessage(status);
			}
		};
		Platform.addLogListener(this.logListener);
	}

	public void uninstall() {
		Platform.removeLogListener(this.logListener);
		if (this.logWriter != null) {
			try {
				this.logWriter.close();
			} catch (IOException e) {
				// ignore
			}
			this.logWriter = null;
		}
	}
{'fraction_non_alphanumeric': 0.09599783666846945, 'fraction_numerical': 0.0, 'mean_word_length': 4.42375366568915, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2774761', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1093, 'n_words': 291}