Extending Appenders
I've tried extending the appenders with the following code and keep getting errors: @Plugin(name = "Stub", category = "Core", elementType = "appender", printObject = true) 2.public final class StubAppender extends OutputStreamAppender { 3. 4.private StubAppender(String name, Layout layout, Filter filter, StubManager manager, 5. boolean ignoreExceptions) { 6.} 7. 8.@PluginFactory 9.public static StubAppender createAppender(@PluginAttribute("name") String name, 10. @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, 11. @PluginElement("Layout") Layout layout, 12. @PluginElement("Filters") Filter filter) { 13. 14.if (name == null) { 15.LOGGER.error("No name provided for StubAppender"); 16.return null; 17.} 18. 19.StubManager manager = StubManager.getStubManager(name); 20.if (manager == null) { 21.return null; 22.} 23.if (layout == null) { 24.layout = PatternLayout.createDefaultLayout(); 25.} 26.return new StubAppender(name, layout, filter, manager, ignoreExceptions); 27.} 28.} I got this example from here: http://logging.apache.org/log4j/2.x/manual/extending.html It tells me that OutputStreamAppender and LOGGER is not defined. I'm a little confused on what to do with this issue. Additonally, I'm not familiar with StubManager and it's implementation, any insight is GREATLY appreciated. Thank you, -Dean -- View this message in context: http://apache-logging.6191.n7.nabble.com/Extending-Appenders-tp49160.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Dynamically (programmatically) add logger in Log4j2
I've created the request LOG4J2-468. It appears as though it is currently being reviewed. Hopefully this will be resolved soon. We (amongst many other companies) use this functionality extensively for monitoring production environments. Thank you Ralph Goers and Andre Bogus for researching the issue. -Dean -- View this message in context: http://apache-logging.6191.n7.nabble.com/Dynamically-programmatically-add-logger-in-Log4j2-tp42273p42305.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Dynamically (programmatically) add logger in Log4j2
I've tried that and the logConf returned is from the root logConfig (name=""). I want to add an additional logger with the name (x.y.z). I do not want to change the log level of the root logger in this case. Any other thoughts? -- View this message in context: http://apache-logging.6191.n7.nabble.com/Dynamically-programmatically-add-logger-in-Log4j2-tp42273p42275.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Dynamically (programmatically) add logger in Log4j2
I'm trying to create an admin console for log4j2 similar to what we have done for log4j 1.x We list out the loggers and their current log level. We also have links on the right side to allow users to click on the link and let them update their log level to any level of their choosing. Finally, we give them a text box to add a new logger (i.e., x.y.z), indicate their log level and click add. Unfortunately, I have not found a way to add a new logger programmatically in log4j2. Does anyone have any advice on how I can do this programmatically? It needs to be dynamic in case the logger was not created at the time of deployment. Thank you in advance. -Dean -- View this message in context: http://apache-logging.6191.n7.nabble.com/Dynamically-programmatically-add-logger-in-Log4j2-tp42273.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org