Repository: logging-log4j2 Updated Branches: refs/heads/master 19a79ec5f -> 403bccddd
[LOG4J2-1126] Site fixes/improvements for 2.4 release. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/403bccdd Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/403bccdd Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/403bccdd Branch: refs/heads/master Commit: 403bccddd423868a4e6fc83ff02234c85b5bbafb Parents: 19a79ec Author: ggregory <[email protected]> Authored: Mon Sep 21 14:42:25 2015 -0700 Committer: ggregory <[email protected]> Committed: Mon Sep 21 14:42:25 2015 -0700 ---------------------------------------------------------------------- src/site/xdoc/faq.xml | 23 ----------------------- 1 file changed, 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/403bccdd/src/site/xdoc/faq.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/faq.xml b/src/site/xdoc/faq.xml index efc7fed..6491624 100644 --- a/src/site/xdoc/faq.xml +++ b/src/site/xdoc/faq.xml @@ -29,7 +29,6 @@ <li><a href="#config_location">How do I specify the configuration file location?</a></li> <li><a href="#config_from_code">How do I configure log4j2 in code without a configuration file?</a></li> <li><a href="#reconfig_from_code">How do I reconfigure log4j2 in code with a specific configuration file?</a></li> - <li><a href="#set_logger_level_from_code">How do I change a logger's level in code?</a></li> <li><a href="#shutdown">How do I shut down log4j2 in code?</a></li> <li><a href="#config_sep_appender_level">How do I send log messages with different levels to different appenders?</a></li> <li><a href="#troubleshooting">How do I debug my configuration?</a></li> @@ -80,28 +79,6 @@ File file = new File("path/to/a/different/log4j2.xml"); context.setConfigLocation(file.toURI()); </pre> - <a name="set_logger_level_from_code" /> - <h4>How do I change a logger's level in code?</h4> - <p>See the below example. - Be aware that these classes are not part of the public API so your code may break with any minor release.</p> - <pre class="prettyprint linenums">// import org.apache.logging.log4j.core.LoggerContext; -// import org.apache.logging.log4j.core.config.Configuration; -// import org.apache.logging.log4j.core.config.LoggerConfig; - -LoggerContext context = (LoggerContext) LogManager.getContext(false); -Configuration config = context.getConfiguration(); -LoggerConfig rootConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); -rootConfig.setLevel(Level.DEBUG); - -// You could also specify the actual logger name as below -// and it will return the LoggerConfig used by the Logger. -LoggerConfig loggerConfig = config.getLoggerConfig("com.apache.test"); -loggerConfig.setLevel(Level.TRACE); - -// This causes all Loggers to refetch information from their LoggerConfig. -context.updateLoggers(); -</pre> - <a name="shutdown" /> <h4>How do I shut down log4j2 in code?</h4> <p>Normally there is no need to do this manually.
