static void init ( ) { // NOPMD determineIfNTEventLogIsSupported ( ) ; URL resource = null ; final String configurationOptionStr = OptionConverter . getSystemProperty ( DEFAULT_CONFIGURATION_KEY , null ) ; if ( configurationOptionStr != null ) { try { resource = new URL ( configurationOptionStr ) ; } catch ( MalformedURLException ex ) { // so, resource is not a URL: // attempt to get the resource from the class path resource = Loader . getResource ( configurationOptionStr ) ; } } if ( resource == null ) { resource = Loader . getResource ( DEFAULT_CONFIGURATION_FILE ) ; // NOPMD } if ( resource == null ) { System . err . println ( "[FoundationLogger] Can not find resource: " + DEFAULT_CONFIGURATION_FILE ) ; // NOPMD throw new FoundationIOException ( "Can not find resource: " + DEFAULT_CONFIGURATION_FILE ) ; // NOPMD } // update the log manager to use the Foundation repository. final RepositorySelector foundationRepositorySelector = new FoundationRepositorySelector ( FoundationLogFactory . foundationLogHierarchy ) ; LogManager . setRepositorySelector ( foundationRepositorySelector , null ) ; // set logger to info so we always want to see these logs even if root // is set to ERROR. final Logger logger = getLogger ( FoundationLogger . class ) ; final String logPropFile = resource . getPath ( ) ; log4jConfigProps = getLogProperties ( resource ) ; // select and configure again so the loggers are created with the right // level after the repository selector was updated. OptionConverter . selectAndConfigure ( resource , null , FoundationLogFactory . foundationLogHierarchy ) ; // start watching for property changes setUpPropFileReloading ( logger , logPropFile , log4jConfigProps ) ; // add syslog appender or windows event viewer appender // setupOSSystemLog(logger, log4jConfigProps); // parseMarkerPatterns(log4jConfigProps); // parseMarkerPurePattern(log4jConfigProps); // udpateMarkerStructuredLogOverrideMap(logger); AbstractFoundationLoggingMarker . init ( ) ; updateSniffingLoggersLevel ( logger ) ; setupJULSupport ( resource ) ; }
Initialize that Foundation Logging library .