logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpsen...@apache.org
Subject svn commit: r1511223 - /logging/log4net/trunk/src/site/xdoc/release/faq.xml
Date Wed, 07 Aug 2013 09:26:57 GMT
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>



Mime
View raw message