Examples of LogService


Examples of org.osgi.service.log.LogService

        log = (LogReaderService) osgiHelper.getServiceObject(LogReaderService.class.getName(), null);
        if (log == null) {
            throw new RuntimeException("No Log Service !");
        }

        LogService logs = (LogService) osgiHelper.getServiceObject(LogService.class.getName(), null);
        logs.log(LogService.LOG_WARNING, "Ready");
    }
View Full Code Here

Examples of org.osgi.service.log.LogService

     * Internal log method.
     * @param level the level of the message.
     * @param msg the message to log
     */
    private void dispatch(int level, String msg) {
        LogService log = null;
        ServiceReference ref = null;
        try {
            // Security Check
            if (SecurityHelper.hasPermissionToGetService(LogService.class.getName(), m_context)) {
                ref = m_context.getServiceReference(LogService.class.getName());
            } else {
                Extender.getIPOJOBundleContext().getServiceReference(LogService.class.getName());
            }

            if (ref != null) {
                log = (LogService) m_context.getService(ref);
            }
        } catch (IllegalStateException e) {
            // Handle the case where the iPOJO bundle is stopping
        }

        String message = null;
        String name = m_name;
        if (name == null) {
            name = "";
        }

        switch (level) {
            case DEBUG:
                message = "[DEBUG] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_DEBUG, message);
                } else {
                    System.err.println(message);
                }
                break;
            case ERROR:
                message = "[ERROR] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_ERROR, message);
                } else {
                    System.err.println(message);
                }
                break;
            case INFO:
                message = "[INFO] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_INFO, message);
                } else {
                    System.err.println(message);
                }
                break;
            case WARNING:
                message = "[WARNING] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_WARNING, message);
                } else {
                    System.err.println(message);
                }
                break;
            default:
View Full Code Here

Examples of org.osgi.service.log.LogService

     * @param level the level of the message.
     * @param msg the message to log
     * @param exception the exception attached to the message
     */
    private void dispatch(int level, String msg, Throwable exception) {
        LogService log = null;
        ServiceReference ref = null;
        try {
            // Security Check
            if (SecurityHelper.hasPermissionToGetService(LogService.class.getName(), m_context)) {
                ref = m_context.getServiceReference(LogService.class.getName());
            } else {
                Extender.getIPOJOBundleContext().getServiceReference(LogService.class.getName());
            }

            if (ref != null) {
                log = (LogService) m_context.getService(ref);
            }
        } catch (IllegalStateException e) {
            // Handle the case where the iPOJO bundle is stopping
        }

        String message = null;
        String name = m_name;
        if (name == null) {
            name = "";
        }

        switch (level) {
            case DEBUG:
                message = "[DEBUG] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_DEBUG, message, exception);
                } else {
                    System.err.println(message);
                    exception.printStackTrace();
                }
                break;
            case ERROR:
                message = "[ERROR] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_ERROR, message, exception);
                } else {
                    System.err.println(message);
                    exception.printStackTrace();
                }
                break;
            case INFO:
                message = "[INFO] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_INFO, message, exception);
                } else {
                    System.err.println(message);
                    exception.printStackTrace();
                }
                break;
            case WARNING:
                message = "[WARNING] " + name + " : " + msg;
                if (log != null) {
                    log.log(LogService.LOG_WARNING, message, exception);
                } else {
                    System.err.println(message);
                    exception.printStackTrace();
                }
                break;
View Full Code Here

Examples of org.osgi.service.log.LogService

        super.open();
    }

    public void log(int level, String message)
    {
        LogService log = getLog();
        if (log != null)
        {
            log.log(level, message);
        }

    }
View Full Code Here

Examples of org.osgi.service.log.LogService

    }

    public void log(int level, String message, Throwable exception)
    {
        LogService log = getLog();
        if (log != null)
        {
            log.log(level, message, exception);
        }
    }
View Full Code Here

Examples of org.osgi.service.log.LogService

    /**
     * @see org.osgi.service.log.LogService#log(int, java.lang.String)
     */
    public void log(int level, String message) {
        LogService logService = (LogService) getService();
        if (logService != null) {
            logService.log(level, message);
        }
    }
View Full Code Here

Examples of org.osgi.service.log.LogService

    /**
     * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable)
     */
    public void log(int level, String message, Throwable exception) {
        LogService logService = (LogService) getService();
        if (logService != null) {
            logService.log(level, message, exception);
        }
    }
View Full Code Here

Examples of org.restlet.service.LogService

            this.helper = new ComponentHelper(this);
            this.defaultHost = new VirtualHost(getContext()
                    .createChildContext());
            this.internalRouter = new InternalRouter(getContext()
                    .createChildContext());
            this.services.add(new LogService());
            this.services.add(new StatusService());
            this.clients.setContext(getContext());
            this.servers.setContext(getContext());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.