/** * setLoggingContext * * <p>Set the logging configuration and logging level for this resource. * * @param String URL of the logging configuration file to load * @param int oldstyle_loglevel used from command line startup of a resource * @param logging.Resource a content class from the logging.ResourceCtx tree */ public void setLoggingContext(String logcfg_url, int oldstyle_loglevel, logging.ResourceCtx ctx) { // test we have a logging URI if (logcfg_url == null || logcfg_url == "") { logging.ConfigureDefault(); } else { // apply any context data if (ctx != null) { ctx.apply(this.loggingMacros); this.loggingCtx = ctx; } // call setLogConfigURL to load configuration and set log4j if (logcfg_url != null) { setLogConfigURL(logcfg_url); } } try { if (oldstyle_loglevel > -1) { // set log level for this logger setLogLevel(logName, logging.ConvertLogLevel(oldstyle_loglevel)); } else { // grab root logger's level logLevel = logging.ConvertLog4ToCFLevel(Logger.getRootLogger().getLevel()); } } catch (Exception e) { } }
/** * saveLoggingContext * * <p>Set the logging configuration and logging level for this resource. This original * configuration context for log4j is applied to the library before a Domain resource is actually * constructed. * * <p>The logging configuration information is retained by this class for the underlying Domain * resource. Additionaly, the EventChannelManager accessible via the Domain can now be used by the * RH_LogEventAppender. * * @param String URL of the logging configuration file to load * @param int oldstyle_loglevel used from command line startup of a resource * @param logging.Resource a content class from the logging.ResourceCtx tree */ public void saveLoggingContext( String logcfg_url, int oldstyle_loglevel, logging.ResourceCtx ctx, org.ossie.events.Manager ECM) { // apply any context data if (ctx != null) { ctx.apply(this.loggingMacros); this.loggingCtx = ctx; } // save off configuration that we are given try { this.loggingURL = logcfg_url; if (logcfg_url == null || logcfg_url == "") { this.logConfig = logging.GetDefaultConfig(); } else { String cfg_data = ""; cfg_data = logging.GetConfigFileContents(logcfg_url); if (cfg_data.length() > 0) { // process file with macro expansion.... this.logConfig = logging.ExpandMacros(cfg_data, loggingMacros); } else { _logger.warn("URL contents could not be resolved, url: " + logcfg_url); } } } catch (Exception e) { _logger.warn("Exception caught during logging configuration using URL, url: " + logcfg_url); } if (oldstyle_loglevel > -1) { logLevel = logging.ConvertLogLevel(oldstyle_loglevel); try { if (_logger != null) { _logger.setLevel(logging.ConvertLogLevelToLog4(oldstyle_loglevel)); } else { setLogLevel(logName, logging.ConvertLogLevel(oldstyle_loglevel)); } } catch (Exception e) { } } else { // grab root logger's level logLevel = logging.ConvertLog4ToCFLevel(Logger.getRootLogger().getLevel()); } // attach this resource to any special appenders that require access to domain resources // set the resource context for the logging library to use // for event channel appenders... needs to occur after // Domain awareness is established logging.SetEventChannelManager(ECM); }
/** * setLoggingContext * * <p>Set the logging configuration and logging level for this resource * * @param logging.Resource a content class from the logging.ResourceCtx tree */ public void setLoggingContext(logging.ResourceCtx ctx) { // apply any context data if (ctx != null) { ctx.apply(this.loggingMacros); this.loggingCtx = ctx; } else if (this.loggingCtx != null) { this.loggingCtx.apply(this.loggingMacros); } // call setLogConfigURL to load configuration and set log4j if (this.loggingURL != null) { setLogConfigURL(this.loggingURL); } try { // set log level for this logger setLogLevel(this.logName, this.logLevel); } catch (Exception e) { } }
/** * setResourceContext * * <p>Use the logging resource context class to set any logging macro definitions. * * @param logging.Resource a content class from the logging.ResourceCtx tree */ public void setResourceContext(logging.ResourceCtx ctx) { if (ctx != null) { ctx.apply(this.loggingMacros); this.loggingCtx = ctx; } }