From 0fbc12de557c426a4c41195bbce58cdcf8ed4e25 Mon Sep 17 00:00:00 2001 From: "tamas.kiss" Date: Sun, 12 Feb 2017 16:00:37 +0100 Subject: [PATCH] Remove JUL configuration Motivation: The static initializer of ScssStyleSheet overrides the logger configuration, causing side effects in the surrounding application. To prevent this, the related code has been removed along with the now unused logging.properties and CustomConsoleHandler. Resolves #258 --- .../com/vaadin/sass/CustomConsoleHandler.java | 51 ------------------- .../vaadin/sass/internal/ScssStylesheet.java | 15 ------ src/main/resources/logging.properties | 5 -- 3 files changed, 71 deletions(-) delete mode 100644 src/main/java/com/vaadin/sass/CustomConsoleHandler.java delete mode 100644 src/main/resources/logging.properties diff --git a/src/main/java/com/vaadin/sass/CustomConsoleHandler.java b/src/main/java/com/vaadin/sass/CustomConsoleHandler.java deleted file mode 100644 index 2c3d2a1e..00000000 --- a/src/main/java/com/vaadin/sass/CustomConsoleHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.sass; - -import java.io.PrintStream; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.LogRecord; - -/** - * - * @author Vaadin Ltd - */ -public class CustomConsoleHandler extends ConsoleHandler { - - private ConsoleHandler stdoutHandler; - - public CustomConsoleHandler() { - PrintStream err = System.err; - /* - * ConsoleHandler uses System.err to output all messages. Replace - * System.err temporary to construct ConsoleHandler and set it back - * after construction. - */ - System.setErr(System.out); - stdoutHandler = new ConsoleHandler(); - System.setErr(err); - } - - @Override - public void publish(LogRecord record) { - if (!Level.SEVERE.equals(record.getLevel())) { - stdoutHandler.publish(record); - } else { - super.publish(record); - } - } -} diff --git a/src/main/java/com/vaadin/sass/internal/ScssStylesheet.java b/src/main/java/com/vaadin/sass/internal/ScssStylesheet.java index f224df7d..848b6e8e 100644 --- a/src/main/java/com/vaadin/sass/internal/ScssStylesheet.java +++ b/src/main/java/com/vaadin/sass/internal/ScssStylesheet.java @@ -365,21 +365,6 @@ private String buildString(BuildStringStrategy strategy) { return output; } - static { - String logFile = System.getProperty("java.util.logging.config.file"); - if (logFile == null) { - try { - LogManager.getLogManager().readConfiguration( - ScssStylesheet.class - .getResourceAsStream("/logging.properties")); - } catch (SecurityException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - @Override public Node copy() { throw new UnsupportedOperationException( diff --git a/src/main/resources/logging.properties b/src/main/resources/logging.properties deleted file mode 100644 index dc5a2806..00000000 --- a/src/main/resources/logging.properties +++ /dev/null @@ -1,5 +0,0 @@ -# handlers = com.vaadin.sass.CustomConsoleHandler -handlers = java.util.logging.ConsoleHandler -.level = INFO - -com.vaadin.sass=WARNING \ No newline at end of file