Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.LogService


                Domain domain=ConfigAPIHelper.getDomainConfigBean(configCtxt);

                // get the nodeagent by name, need it as soon as possible for logging
                String nodeAgentName=System.getProperty(SystemPropertyConstants.SERVER_NAME);
                NodeAgent nodeAgent=NodeAgentHelper.getNodeAgentByName(configCtxt, nodeAgentName);
                LogService logService=nodeAgent.getLogService();

                if(logService != null) {
                    getLogger().log(Level.FINE, "LogService found for nodeagent");
                    // get logservice info from config beans
                    String logFileX=logService.getFile();

                    if (logFileX !=null) {
                        logFile=logFileX;
                        // add log to properties so NodeAgentMain will redirect is applicable
                        systemProperties.setProperty(LOGFILE_SYSTEM_PROPERTY, logFile);               
                    }

                    // set log level to the level that the nodeagent is set to
                    String logLevel=logService.getModuleLogLevels().getNodeAgent();
                    getLogger().setLevel(Level.parse(logLevel));
                }
            } catch (ConfigException ce) {
                // domain.xml should not be there on first start up, just log
                getLogger().log(Level.FINE,"domain.xml does not exist yet for the nodeagent");
View Full Code Here


     * @param config This represents the config element in domain.xml for the server
     * @return logFile Log file for server
     */
    protected String configureLogService(Config config) {
        String logFile="";
        LogService logService=config.getLogService();
        if(logService != null) {
            // get logservice info from config beans
            logFile=logService.getFile();
            String logLevel=logService.getModuleLogLevels().getAdmin();
           
            // set log level to the level that the instance is set to (for internal instances only
            getLogger().setLevel(Level.parse(logLevel));
        }
        return logFile;
View Full Code Here

                "Error in creating web modules manager: ", cx);
        }

        setNoTldScan();

        LogService logService = null;

        try {
            domain = (Domain) _configContext.getRootConfigBean();

            _serverBean = ServerBeansFactory.getServerBean(_configContext);

            getDynamicReloadingSettings(ServerBeansFactory.getDasConfigBean(_configContext));

            Config cfg = ServerBeansFactory.getConfigBean(_configContext);
            logService = cfg.getLogService();
            initLogLevel(logService);
            initMonitoringLevel(cfg.getMonitoringService());

            ElementProperty maxDepth
                = ServerBeansFactory.getWebContainerBean(_configContext).getElementPropertyByName(DISPATCHER_MAX_DEPTH);
            if (maxDepth != null && maxDepth.getValue() != null) {

                int depth = -1;
                try {
                    depth = Integer.parseInt(maxDepth.getValue());
                } catch (Exception e) {}

                if (depth > 0) {
                    CoyoteRequest.setMaxDispatchDepth(depth);
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.fine("Maximum depth for nested request "
                                     + "dispatches set to "
                                     + maxDepth.getValue());
                    }
                }
            }

        } catch (ConfigException e) {
            _logger.log(Level.SEVERE, "webcontainer.configError", e);
        }

        String logServiceFile = null;
        if (logService != null) {
            logServiceFile = logService.getFile();
        }
        _embedded = new EmbeddedWebContainer(_logger, _serverContext, this,
                                             logServiceFile);
        _embedded.setUseNaming(false);
        if (_debug > 1)
View Full Code Here

            authRealms[0].addElementProperty(jaasContextProperty);
            controller.setAuthRealm(authRealms[0]);

            controller.setSystemJmxConnectorName(SYSTEM_CONNECTOR_NAME);

            LogService log = new LogService();
            ModuleLogLevels logLevels = new ModuleLogLevels();
            log.setModuleLogLevels(logLevels);
            log.setFile("${com.sun.aas.instanceRoot}/logs/server.log");
            controller.setLogService(log);

            controllers.addNodeAgent(controller, OVERWRITE);

            //Notify the Node Agent to rendezvous
View Full Code Here

    }

    private void doUpgrade(Config config) {
        // v3 uses logging.properties to configure the logging facility.
        // move all log-service elements to logging.properties
        final LogService logService = config.getLogService();
       
      // check if null and exit
      if (logService == null )
        return;
  // get a copy of the logging.properties file

       try {
          RepositoryConfig rc = new RepositoryConfig();
            String configDir = rc.getRepositoryRoot()+  File.separator +rc.getRepositoryName() +
                     File.separator+ rc.getInstanceName() +File.separator + "config";
          PEFileLayout layout = new PEFileLayout(rc);
          File src = new File(layout.getTemplatesDir(), PEFileLayout.LOGGING_PROPERTIES_FILE);
          File dest = new File (configDir, PEFileLayout.LOGGING_PROPERTIES_FILE);
            if  (!dest.exists())
                FileUtils.copy(src, dest);
            
      } catch (IOException ioe) {
            Logger.getAnonymousLogger().log(Level.SEVERE, "Failure while upgrading log-service. Could not create logging.properties file. ", ioe);    
      }

        try {
            //Get the logLevels
            ModuleLogLevels mll = logService.getModuleLogLevels();

            Map<String, String> logLevels = mll.getAllLogLevels();
            String file=logService.getFile();
            String instanceRoot = System.getProperty("com.sun.aas.instanceRoot");
            if (file.contains(instanceRoot)){
                file = file.replace(instanceRoot ,"${com.sun.aas.instanceRoot}");
            }
            logLevels.put("file", file);
            logLevels.put("use-system-logging", logService.getUseSystemLogging());
            //this can have multiple values so need to add
            logLevels.put("log-handler", logService.getLogHandler());
            logLevels.put("log-filter", logService.getLogFilter());
            logLevels.put("log-to-console",logService.getLogToConsole());
            logLevels.put("log-rotation-limit-in-bytes",logService.getLogRotationLimitInBytes());
            logLevels.put("log-rotation-timelimit-in-minutes", logService.getLogRotationTimelimitInMinutes());
            logLevels.put("alarms", logService.getAlarms());
            logLevels.put("retain-error-statistics-for-hours", logService.getRetainErrorStatisticsForHours());
            final Map<String, String> m =  new HashMap<String,String>(logLevels);

            ConfigSupport.apply(new SingleConfigCode<Config>() {
                public Object run(Config c) throws PropertyVetoException, TransactionFailure {
View Full Code Here

    }

    private void doUpgrade(Config config) {
        // v3 uses logging.properties to configure the logging facility.
        // move all log-service elements to logging.properties
        final LogService logService = config.getLogService();
       
      // check if null and exit
      if (logService == null )
        return;
  // get a copy of the logging.properties file

       try {
          RepositoryConfig rc = new RepositoryConfig();
            String configDir = rc.getRepositoryRoot()+  File.separator +rc.getRepositoryName() +
                     File.separator+ rc.getInstanceName() +File.separator + "config";
          PEFileLayout layout = new PEFileLayout(rc);
          File src = new File(layout.getTemplatesDir(), PEFileLayout.LOGGING_PROPERTIES_FILE);
          File dest = new File (configDir, PEFileLayout.LOGGING_PROPERTIES_FILE);
            if  (!dest.exists())
                FileUtils.copy(src, dest);
            
      } catch (IOException ioe) {
            Logger.getAnonymousLogger().log(Level.SEVERE, "Failure while upgrading log-service. Could not create logging.properties file. ", ioe);    
      }

        try {
            //Get the logLevels
            ModuleLogLevels mll = logService.getModuleLogLevels();

            Map<String, String> logLevels = mll.getAllLogLevels();
            String file=logService.getFile();
            String instanceRoot = System.getProperty("com.sun.aas.instanceRoot");
            if (file.contains(instanceRoot)){
                file = file.replace(instanceRoot ,"${com.sun.aas.instanceRoot}");
            }
            logLevels.put("file", file);
            logLevels.put("use-system-logging", logService.getUseSystemLogging());
            //this can have multiple values so need to add
            logLevels.put("log-handler", logService.getLogHandler());
            logLevels.put("log-filter", logService.getLogFilter());
            logLevels.put("log-to-console",logService.getLogToConsole());
            logLevels.put("log-rotation-limit-in-bytes",logService.getLogRotationLimitInBytes());
            logLevels.put("log-rotation-timelimit-in-minutes", logService.getLogRotationTimelimitInMinutes());
            logLevels.put("alarms", logService.getAlarms());
            logLevels.put("retain-error-statistics-for-hours", logService.getRetainErrorStatisticsForHours());
            final Map<String, String> m =  new HashMap<String,String>(logLevels);

            ConfigSupport.apply(new SingleConfigCode<Config>() {
                public Object run(Config c) throws PropertyVetoException, TransactionFailure {
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.LogService

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.