| | |
| | | // The singleton instance of this class for configuration purposes. |
| | | static final DebugLogger instance = new DebugLogger(); |
| | | |
| | | static |
| | | { |
| | | // Install the startup publishers if necessary until the config kicks in and |
| | | // adds the real publishers. |
| | | |
| | | if(DynamicConstants.WEAVE_ENABLED) |
| | | { |
| | | try |
| | | { |
| | | TextDebugLogPublisher startupDebugPublisher = |
| | | TextDebugLogPublisher.getStartupTextDebugPublisher( |
| | | new TextWriter.STDOUT()); |
| | | |
| | | debugPublishers.put(DN.NULL_DN, |
| | | startupDebugPublisher); |
| | | enabled = true; |
| | | |
| | | // Update all existing aspect instances |
| | | addTracerSettings(startupDebugPublisher); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | System.err.println("Error installing the startup debug logger: " + |
| | | StaticUtils.stackTraceToSingleLineString(e)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Add an debug log publisher to the debug logger. |
| | | * |
| | |
| | | DebugLogPublisher publisher) |
| | | { |
| | | debugPublishers.put(dn, publisher); |
| | | |
| | | // Update all existing aspect instances |
| | | addTracerSettings(publisher); |
| | | |
| | | enabled = DynamicConstants.WEAVE_ENABLED; |
| | | } |
| | | |
| | |
| | | if(removed != null) |
| | | { |
| | | removed.close(); |
| | | removeTracerSettings(removed); |
| | | } |
| | | |
| | | if(debugPublishers.isEmpty()) |
| | |
| | | for(DebugLogPublisher publisher : debugPublishers.values()) |
| | | { |
| | | publisher.close(); |
| | | removeTracerSettings(publisher); |
| | | } |
| | | |
| | | debugPublishers.clear(); |
| | |
| | | DebugLogPublisher debugLogPublisher = getDebugPublisher(config); |
| | | |
| | | addDebugLogPublisher(config.dn(), debugLogPublisher); |
| | | |
| | | // Update all existing aspect instances |
| | | addTracerSettings(debugLogPublisher); |
| | | } |
| | | } |
| | | } |
| | |
| | | getDebugPublisher(config); |
| | | |
| | | addDebugLogPublisher(config.dn(), debugLogPublisher); |
| | | |
| | | addTracerSettings(debugLogPublisher); |
| | | } |
| | | catch(ConfigException e) |
| | | { |
| | |
| | | else |
| | | { |
| | | // The publisher is being disabled so shut down and remove. |
| | | removeTracerSettings(debugLogPublisher); |
| | | removeDebugLogPublisher(config.dn()); |
| | | } |
| | | } |
| | |
| | | boolean adminActionRequired = false; |
| | | |
| | | DebugLogPublisher publisher = removeDebugLogPublisher(config.dn()); |
| | | if(publisher != null) |
| | | { |
| | | removeTracerSettings(publisher); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | } |