Package java.util.logging

Examples of java.util.logging.Handler


        System.loadLibrary("LCJPEG");
        System.loadLibrary("LCTIFF");

        // Abbreviate metadata error messages, which can be scroll blinding.
        Logger logger = Logger.getLogger("com.lightcrafts.image.metadata");
        Handler handler = new TerseLoggingHandler(System.out);
        logger.addHandler(handler);
        logger.setUseParentHandlers(false);

        ProgressDialog dialog = Platform.getPlatform().getProgressDialog();
        ProgressThread thread = new ProgressThread(dialog) {
View Full Code Here


    }

    private static void initLogging() {
        // Abbreviate metadata error messages, which can be scroll blinding.
        Logger logger = Logger.getLogger("com.lightcrafts.image.metadata");
        Handler handler = new TerseLoggingHandler(System.out);
        logger.addHandler(handler);
        logger.setUseParentHandlers(false);
    }
View Full Code Here

     */
  public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
            ESeq argv = process_args(args);
            maybe_print_banner();

      Handler fh = new FileHandler("erjang.log");
      Logger.getLogger("").addHandler(fh);
     // Logger.getLogger("erjang").setLevel(Level.FINE);
      // Logger.getLogger("kilim.Task").setLevel(Level.FINEST);

    load_modules_and_drivers(Arrays.asList(MODULES), Arrays.asList(DRIVERS));
View Full Code Here

            }

            // Connect to the legacy API
            VConsole.setImplementation(window);

            Handler errorNotificationHandler = GWT
                    .create(ErrorNotificationHandler.class);
            Logger.getLogger("").addHandler(errorNotificationHandler);
        }

        if (LogConfiguration.loggingIsEnabled()) {
View Full Code Here

    }

    @Test
    public void containsId_unknownObject() throws SQLException {

        Handler ensureNoLogging = new Handler() {

            @Override
            public void publish(LogRecord record) {
                Assert.fail("No messages should be logged");
View Full Code Here

            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
                    final ServiceController<Handler> controller = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(name));
                    if (controller != null) {
                        final Handler handler = controller.getValue();
                        if (operation.hasDefined(LEVEL)) {
                            handler.setLevel(Level.parse(operation.get(LEVEL).asString()));
                        }
                        if (operation.hasDefined(FORMATTER)) {
                            new PatternFormatterSpec(operation.get(FORMATTER).asString()).apply(handler);
                        }
                        if (operation.hasDefined(ENCODING)) {
                            try {
                                handler.setEncoding(operation.get(ENCODING).asString());
                            } catch (UnsupportedEncodingException e) {
                                throw new OperationFailedException(e, new ModelNode().set("Failed to set handler encoding."));
                            }
                        }
                        updateRuntime(operation, handler);
View Full Code Here

                sb.append(record.getMessage());
                sb.append("\n");
                return sb.toString();
            }
        };
        Handler ch = new ConsoleHandler();
        ch.setFormatter(sf);
        Logger globalLog = Logger.getLogger("");
        globalLog.addHandler(ch);
       
        ch.setLevel(consoleLevel);
    }
View Full Code Here

    /*=================================
          Main class implementation
     *=================================*/

    public static void main(String[] args) throws Exception {
        Handler fh = new ConsoleHandler();
        fh.setLevel(Level.FINEST);
        fh.setFormatter(new Formatter() {
            @Override
            public String format(LogRecord record) {
                String message = formatMessage(record);
                String throwable = "";
                if (record.getThrown() != null) {
View Full Code Here

        properties = new ArrayList<Property>();
    }

    @Override
    public synchronized void start(final StartContext context) throws StartException {
        final Handler handler;
        final ModuleLoader moduleLoader = Module.forClass(CustomHandlerService.class).getModuleLoader();
        final ModuleIdentifier id = ModuleIdentifier.create(moduleName);
        try {
            final Class<?> handlerClass = Class.forName(className, false, moduleLoader.loadModule(id).getClassLoader());
            if (Handler.class.isAssignableFrom(handlerClass)) {
                handler = (Handler) handlerClass.newInstance();
            } else {
                throw MESSAGES.invalidType(className, Handler.class);
            }
        } catch (ClassNotFoundException e) {
            throw MESSAGES.classNotFound(e, className);
        } catch (ModuleLoadException e) {
            throw MESSAGES.cannotLoadModule(e, moduleName);
        } catch (InstantiationException e) {
            throw MESSAGES.cannotInstantiateClass(e, className);
        } catch (IllegalAccessException e) {
            throw MESSAGES.cannotAccessClass(e, className);
        }
        if (filter != null) handler.setFilter(filter);
        formatterSpec.apply(handler);
        if (level != null) handler.setLevel(level);
        try {
            handler.setEncoding(encoding);
        } catch (UnsupportedEncodingException e) {
            throw new StartException(e);
        }
        // Set the properties
        setProperties(handler, properties);
View Full Code Here

        value = handler;
    }

    @Override
    public synchronized void stop(final StopContext context) {
        final Handler handler = value;
        handler.close();
        properties.clear();
        value = null;
    }
View Full Code Here

TOP

Related Classes of java.util.logging.Handler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.