You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by dp...@apache.org on 2013/08/07 11:26:57 UTC

svn commit: r1511223 - /logging/log4net/trunk/src/site/xdoc/release/faq.xml

Author: dpsenner
Date: Wed Aug  7 09:26:57 2013
New Revision: 1511223

URL: http://svn.apache.org/r1511223
Log:
LOG4NET-342 added a FAQ entry that describes how to check if the repository was configured and how one can enumerate the configuration messages

Modified:
    logging/log4net/trunk/src/site/xdoc/release/faq.xml

Modified: logging/log4net/trunk/src/site/xdoc/release/faq.xml
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/site/xdoc/release/faq.xml?rev=1511223&r1=1511222&r2=1511223&view=diff
==============================================================================
--- logging/log4net/trunk/src/site/xdoc/release/faq.xml (original)
+++ logging/log4net/trunk/src/site/xdoc/release/faq.xml Wed Aug  7 09:26:57 2013
@@ -959,6 +959,27 @@ public class FastLogger
                 </section>
                 <p><a href="#top">Back to Top</a></p>
 
+                <section id="trouble-evaluate-configurationerrors-at-runtime" name="How can I evaluate configuration errors at runtime?">
+                    <p>
+                        To prevent silent failure of log4net as reported as <a href="http://issues.apache.org/jira/browse/LOG4NET-342">LOG4NET-342</a>,
+                        log4net supports a way to evaluate if it was configured and also to evaluate messages generated on startup since 1.2.11. To
+						check if log4net was started and configured properly one can check the property 
+						<span class="code">log4net.Repository.ILoggerRepository.Configured</span> and enumerate the configuration messages as follows:
+                    </p>
+                    <div class="syntax">
+                        <pre class="code">
+if(!log4net.LogManager.GetRepository().Configured)
+{
+	// log4net not configured
+	foreach(log4net.Util.LogLog message in log4net.LogManager.GetRepository().ConfigurationMessages.Cast<log4net.Util.LogLog>())
+	{
+		// evaluate configuration message
+	}
+}
+                        </pre>
+                    </div>
+                </section>
+                <p><a href="#top">Back to Top</a></p>
 
                 <section id="trouble-EventLog" name="Why doesn't the EventLogAppender work?">
                     <p>