You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Joachim Zobel (JIRA)" <ji...@apache.org> on 2012/05/22 19:14:41 UTC

[jira] [Created] (LOG4NET-342) Add a way to prevent silent failure

Joachim Zobel created LOG4NET-342:
-------------------------------------

             Summary: Add a way to prevent silent failure
                 Key: LOG4NET-342
                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
             Project: Log4net
          Issue Type: New Feature
            Reporter: Joachim Zobel




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13284207#comment-13284207 ] 

Ron Grabowski commented on LOG4NET-342:
---------------------------------------

If I'm working in a web app and I can't get basic logging to work I'll do this:

  <appSettings>
    <add key="log4net.Internal.Debug" value="true"/>
  </appSettings>
  <system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="textWriterTraceListener" 
          type="System.Diagnostics.TextWriterTraceListener"
          initializeData="c:\\path\\to\\application\\App_Data\\og4net.txt" />
      </listeners>
    </trace>
  </system.diagnostics>

Starting with 1.2.11, configurators return an ICollection of LogLog messages:

  var errors = XmlConfigurator.Configure().Cast<LogLog>().Where(x => x.Prefix.Contains("ERROR"));

In hindsight the configurators should maintained their current signatures and new methods added to return a strongly typed collection of real objects of a non-generic collection of our internal LogLog object. When I wrote the code I was more concerned with maintaining 1.x compatibility than making it easy for non-legacy apps to use new feature :-/
                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Joachim Zobel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joachim Zobel updated LOG4NET-342:
----------------------------------

    Description: 
I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.

I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 


    
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Psenner updated LOG4NET-342:
------------------------------------

         Priority: Minor  (was: Major)
    Fix Version/s: 1.2.12
    
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13285413#comment-13285413 ] 

Dominik Psenner edited comment on LOG4NET-342 at 5/30/12 6:20 AM:
------------------------------------------------------------------

IsErrorEnabled is quite misleading at this point and depending on the logging configuration it can result to false negatives. I think a proper refactoring+some documentation could do a great favor there so that one can find:

if(log.InitializationState == InitializationStates.INITIALIZED)
   // all fine

Valid members of the InitializationStates enum could be "INITIALIZED", "IN_PROGRESS", "NOT_YET", "FAILED".
                
      was (Author: nachbarslumpi):
    IsErrorEnabled is quite misleading at this point and depending on the logging configuration it can result to false negatives. I think a proper refactoring+some documentation could do a great favor there so that one can find:

if(log.InitializationState == InitializationStates.OK)
   // all fine

Valid members of the InitializationStates enum could be "INITIALIZED", "IN_PROGRESS", "NOT_YET", "FAILED".
                  
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Joachim Zobel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281734#comment-13281734 ] 

Joachim Zobel commented on LOG4NET-342:
---------------------------------------

Internal debugging did not give any output. Neither did running the app as local system to exclude permission problems.

But actually I made this feature request because log4nets silent failing is according to my experience and according to what google finds a frequent problem.

There is also the use case that it is better to have an app that fails than to have an app that acts without logging. The apache httpd is the major app I know that implements this.

                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281419#comment-13281419 ] 

Dominik Psenner commented on LOG4NET-342:
-----------------------------------------

One could add a global boolean configuration named like "EnableExceptionThrowing" that is "False" by default. In case one wants to test something he would then be able to change that flag in the app.config. Once set to "True" all exceptions thrown would no longer be ignored silently, but thrown up to the calling application so that the exception can be debugged/handled in some other way.
                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281419#comment-13281419 ] 

Dominik Psenner edited comment on LOG4NET-342 at 5/23/12 1:23 PM:
------------------------------------------------------------------

One could add a global boolean configuration named like "EnableExceptionThrowing" that is "False" by default. In case one wants to test something he would then be able to change that flag in the app.config. Once set to "True" all exceptions thrown would no longer be ignored silently, but thrown up to the calling application so that the exception can be debugged/handled in some other way.

I just targeted it for 1.2.12 since it should be doable.

EDIT: have you tried to enable log4nets internal debugging as described at http://logging.apache.org/log4net/release/faq.html ? Let us know if that is enough for your usecase.
                
      was (Author: nachbarslumpi):
    One could add a global boolean configuration named like "EnableExceptionThrowing" that is "False" by default. In case one wants to test something he would then be able to change that flag in the app.config. Once set to "True" all exceptions thrown would no longer be ignored silently, but thrown up to the calling application so that the exception can be debugged/handled in some other way.

I just targeted it for 1.2.12 since it should be doable.
                  
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13285164#comment-13285164 ] 

Ron Grabowski commented on LOG4NET-342:
---------------------------------------

Not too difficult to stop your app from starting up if logging isn't configured:

 if (log.IsErrorEnabled == false)
 {
  throw new ConfigurationErrorsException("Log4net failed to initialize properly.");
 }
                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13285444#comment-13285444 ] 

Dominik Psenner commented on LOG4NET-342:
-----------------------------------------

Oh, I just noticed that there is a "Configured" property in Hierarchy that could be wrapped in Logger like this:

		/// <summary>
		/// Gets the flag that indicates if the repository of this Logger has been configured.
		/// </summary>
		/// <value>
		/// <c>true</c> if the repository of this Logger has been configured.
		/// </value>
		/// <remarks>
		/// <para>
		/// Gets the flag that indicates if this repository has been configured.
		/// </para>
		/// </remarks>
		public bool Configured
		{
			get { return Hierarchy.Configured; }
		}
                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Joachim Zobel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13284964#comment-13284964 ] 

Joachim Zobel commented on LOG4NET-342:
---------------------------------------

I did try internal debugging as you describe it without any results. It was however an exceptionally hard case. I had missed to put Global.asax into the deploy package,  which did the Configure() and lots of logging (DEBUG: Starting page ...).

The Configure return value is actually very helpful in the common case of a confguration failure.

There is however also the use case that application failure is considered peferrable to running without logging. Not sure if log4net wants to cover this.

Thanks,
Joachim

                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13285413#comment-13285413 ] 

Dominik Psenner commented on LOG4NET-342:
-----------------------------------------

IsErrorEnabled is quite misleading at this point and depending on the logging configuration it can result to false negatives. I think a proper refactoring+some documentation could do a great favor there so that one can find:

if(log.InitializationState == InitializationStates.OK)
   // all fine

Valid members of the InitializationStates enum could be "INITIALIZED", "IN_PROGRESS", "NOT_YET", "FAILED".
                
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (LOG4NET-342) Add a way to prevent silent failure

Posted by "Dominik Psenner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281419#comment-13281419 ] 

Dominik Psenner edited comment on LOG4NET-342 at 5/23/12 6:17 AM:
------------------------------------------------------------------

One could add a global boolean configuration named like "EnableExceptionThrowing" that is "False" by default. In case one wants to test something he would then be able to change that flag in the app.config. Once set to "True" all exceptions thrown would no longer be ignored silently, but thrown up to the calling application so that the exception can be debugged/handled in some other way.

I just targeted it for 1.2.12 since it should be doable.
                
      was (Author: nachbarslumpi):
    One could add a global boolean configuration named like "EnableExceptionThrowing" that is "False" by default. In case one wants to test something he would then be able to change that flag in the app.config. Once set to "True" all exceptions thrown would no longer be ignored silently, but thrown up to the calling application so that the exception can be debugged/handled in some other way.
                  
> Add a way to prevent silent failure
> -----------------------------------
>
>                 Key: LOG4NET-342
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-342
>             Project: Log4net
>          Issue Type: New Feature
>            Reporter: Joachim Zobel
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> I spent most of the day trying to find out why logging is not working on my dev system but not on test. There should be a way to force error reporting by throwing (possibly unhandled) exceptions. This could be done by adding a required flag to the appenders and another flag that requires a least one working appender.
> I am not sure about a good way to implement this, I would just love it if my favourite tool to end silent failure could stop failing silently. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira