Package java.util.logging

Examples of java.util.logging.Logger


    /**
     * The entry point for transforms initiate on module load,
     * fetches settings from the <code>application/xslt+xml style</code> element
     */
    public void doTransformation() {
      Logger logger = Logger.getLogger("Xstl20Processor");
        try {        
            NodeList<Element> scripts = getScriptsOnLoad();
            String sourceURI = null;
            String styleURI = null;
            String initialMode = null;
            String initialTemplate = null;
            boolean styleElementExists = false;
            for (int i=0; i<scripts.getLength(); i++) {
                String type = scripts.getItem(i).getAttribute("type");
                if (type.equals("application/xslt+xml")) {
                  styleElementExists = true;
                    styleURI = scripts.getItem(i).getAttribute("src");
                    sourceURI = scripts.getItem(i).getAttribute("data-source");
                    initialMode = scripts.getItem(i).getAttribute("data-initial-mode");
                    initialTemplate = scripts.getItem(i).getAttribute("data-initial-template");
                    break;
                }
            }
           
            if (!styleElementExists) {
              logger.info("Saxon-CE API initialised");
              return;
            } else if (styleURI == null)
              { throw new XPathException("No XSLT stylesheet reference found"); }

            JavaScriptObject sourceDoc = null;
            String absSourceURI = null;
            if (sourceURI != null && sourceURI.length() != 0) {
              String pageHref = Window.Location.getHref();
                absSourceURI = (new URI(pageHref).resolve(sourceURI)).toString();
                if (pageHref.equals(absSourceURI)) {
                  throw new XPathException("Cannot load XML with same URI as the host page");
                }

                sourceDoc = SaxonceApi.createAsyncDoc(absSourceURI); // config.buildDocument(absSourceURI);

            } else if (initialTemplate == null) {
              throw new XPathException("No data-source attribute or data-initial-template value found - one is required");
            }

            String absStyleURI = (new URI(Window.Location.getHref()).resolve(styleURI)).toString();
            DocumentInfo styleDoc;
            try {
                styleDoc = config.buildDocument(absStyleURI);
            } catch (XPathException e) {
              String reportURI = (absSourceURI != null)? absSourceURI : styleURI;
              throw new XPathException("Failed to load XSLT stylesheet " + reportURI + ": " + e.getMessage());
            }
            config.getDocumentPool().add(styleDoc, absStyleURI);     // where document('') can find it
            Element body = getBodyElement();
           
            localController.setInitialMode(initialMode);
            localController.setInitialTemplate(initialTemplate);
            localController.setApiCommand(APIcommand.UPDATE_HTML);
            localController.setTargetNode(Document.get());          // target node is the document node
           
            renderXML(sourceDoc, styleDoc, body);                   // principle output is to the body element

        } catch (Exception err) {
          logger.log(Level.SEVERE, err.getMessage());
        }
    }
View Full Code Here


   * Sends a message into the server log
   * @param message A message to be sent
   */
  public static void log(String message)
  {
    Logger log = Bukkit.getServer().getLogger();
    log.info(message);
  }
View Full Code Here

    public void socketAppenderTest() throws InterruptedException {
        final Util.StringContainer container = Util.readLineFromPort(Util.port, Util.timeoutInMs);

        String helloChina = "Hello, \u4E2D\u570B!";

        Logger logger = Logger.getLogger("splunk.logging");
        logger.info(helloChina);

        synchronized (container) {
            container.wait(Util.timeoutInMs);
        }
View Full Code Here

    private static ImageThrowableHandler Instance = new ImageThrowableHandler();

    private LinkedList throwables = new LinkedList();

    private ImageThrowableHandler() {
        Logger logger = Logger.getLogger("com.lightcrafts.image.metadata");
        logger.addHandler(this);
    }
View Full Code Here

public class JavaUtilLoggerRedirector implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        // remove default handlers
        Logger rootLogger = LogManager.getLogManager().getLogger("");
        for (Handler handler : rootLogger.getHandlers()) {
            rootLogger.removeHandler(handler);
        }
//        install redirecting handler
        SLF4JBridgeHandler.install();
    }
View Full Code Here

    public void addEvent() {
        if (user == null) {
            return;
        }
        validationSuccess = true;
        Logger logger = Logger.getLogger("EventManager");

        try {
            EventCategory ec = eventAction.getEventCategoryById(ecId);
            newEvent.setCategory(ec);

            newShelf.setName(newEvent.getName());
            newShelf.setShared(true);

            newShelf.setEvent(newEvent);
            newEvent.setShelf(newShelf);

            eventAction.addEvent(newEvent);
            shelfAction.addShelf(newShelf);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.EVENT_SAVING_ERROR + " <br /> " + e.getMessage()));
            logger.log(Level.SEVERE, "exception occured", e);
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.EVENT_ADDED_EVENT)).fire(new ShelfEvent(newEvent));
    }
View Full Code Here

      if (args[i].startsWith("-p"))
        epmd_port = toInt(args[i].substring(2), epmd_port);
      if (args[i].startsWith("-d"))
        level = toLevel(toInt(args[i].substring(2), 2));
    }
    final Logger log = Logger.getLogger("erjang.epmd");
    log.setLevel(level);
   
    new EPMDServer().listen(epmd_port);
  }
View Full Code Here

        this.logLevel = logLevel;
    }

    public Void call() {
        try {
            Logger LOG = Logger.getLogger(HubLauncher.class.getName());
            configureLoggers();
            LOG.fine("Grid Hub preparing to start on port " + port);
            GridHubConfiguration c = GridHubConfiguration.build(args);
            c.setPort(port);
            c.setCapabilityMatcher(new JenkinsCapabilityMatcher(Channel.current(), c.getCapabilityMatcher()));
            Hub hub = new Hub(c);
            hub.start();
            HubHolder.hub = hub;

            LOG.fine("Grid Hub started on port " + port);
        } catch (Exception e) {
            Log.error("An error occured while starting the hub", e);
        }

        return null;
View Full Code Here

public class EndpointService implements RequestHandler {
    public static void main(String[] args) {
        configureLogging();
        try {
            int port = (args.length > 0) ? Integer.parseInt(args[0]) : 8888;
            final Logger logger = Logger.getLogger(EndpointService.class.getName());
            logger.log(Level.FINE, "Starting on port " + port);
            HttpServer httpd = new NormalHttpServer(port,
                    new EndpointService(new Endpoint() {
                        public boolean acceptSubscriptionChange(String mode, String topic, String token, int leaseSeconds) {
                            System.out.println("Subscription change: "+mode+", "+topic+", "+token+", "+leaseSeconds);
                            return true;
View Full Code Here

        }
    }

    private static void configureLogging() {
        ConsoleHandler handler = new ConsoleHandler();
        Logger root = Logger.getLogger("");
        root.addHandler(handler);
        handler.setLevel(Level.FINER);
        root.setLevel(Level.FINER);
    }
View Full Code Here

TOP

Related Classes of java.util.logging.Logger

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.