Permalink
Browse files

Moved loggger setup to the Ceylon launcher

  • Loading branch information...
1 parent 7727643 commit 959b715142ce4c7307adb0acfc4653bdf452434c @quintesse quintesse committed Mar 7, 2013
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Red Hat inc. and third party contributors as noted
- * by the author tags.
- *
- * 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 ceylon.modules;
-
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-/**
- * Fix log format.
- *
- * @author Stephane Epardaud
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-class CeylonLogFormatter extends Formatter {
- static final Formatter INSTANCE = new CeylonLogFormatter();
- private static final String MESSAGE_PATTERN = "%s: %s %s\n";
-
- private CeylonLogFormatter() {
- }
-
- @Override
- public String format(LogRecord record) {
- //noinspection ThrowableResultOfMethodCallIgnored
- return String.format(
- MESSAGE_PATTERN,
- getErrorType(record.getLevel()),
- record.getMessage(),
- record.getThrown() == null ? "" : record.getThrown());
- }
-
- private static String getErrorType(Level level) {
- if (level == Level.WARNING)
- return "Warning";
- if (level == Level.INFO)
- return "Note";
- if (level == Level.SEVERE)
- return "Error";
- return "Debug";
- }
-
-}
@@ -19,10 +19,6 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import ceylon.modules.spi.ArgumentType;
import ceylon.modules.spi.Constants;
@@ -69,24 +65,6 @@ public static void execute(String[] args) throws Exception {
throw new CeylonRuntimeException("Missing -executable argument");
}
- try {
- for (Handler handler : Logger.getLogger("").getHandlers()) {
- // This is a hack, but at least it works. With a property file our log
- // formatter has to be in the boot class path. This way it doesn't.
- if (handler instanceof ConsoleHandler) {
- handler.setFormatter(CeylonLogFormatter.INSTANCE);
- if (conf.verbose) {
- handler.setLevel(Level.ALL);
- }
- }
- }
- if (conf.verbose) {
- Logger.getLogger("com.redhat.ceylon.cmr").setLevel(Level.ALL);
- }
- } catch (Throwable ex) {
- System.err.println("Warning: log configuration failed: " + ex.getMessage());
- }
-
Executable executable = createInstance(Executable.class, exe);
executable.execute(conf);
}

0 comments on commit 959b715

Please sign in to comment.