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 "Andy Smith (Created) (JIRA)" <ji...@apache.org> on 2012/04/09 23:11:17 UTC

[jira] [Created] (LOG4NET-331) AdoNetAppender errors when writing Asp.net item when Request object is null

AdoNetAppender errors when writing Asp.net item when Request object is null
---------------------------------------------------------------------------

                 Key: LOG4NET-331
                 URL: https://issues.apache.org/jira/browse/LOG4NET-331
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 1.2.11
         Environment: Windows Server 2008 R2
            Reporter: Andy Smith
            Priority: Minor


When using AdoNetAppender, with a conversion pattern of '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during the Application_Start event, it throws an error (internally) and stops working. The error refers to "...Request is not available in this context.." which makes sense because its only in the Application_Start event. However the appender should accommodate this situation and log null, not throw an error. The RollingFileAppender handles this fine.

--
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

        

Re: [jira] [Commented] (LOG4NET-331) AdoNetAppender errors when writing Asp.net item when Request object is null

Posted by George Chung <ge...@glympse.com>.
The title is not correct. Request is a property whose code throws an
exception.

On Tue, Apr 10, 2012 at 6:11 PM, Ron Grabowski (Commented) (JIRA) <
jira@apache.org> wrote:

>
>    [
> https://issues.apache.org/jira/browse/LOG4NET-331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251223#comment-13251223]
>
> Ron Grabowski commented on LOG4NET-331:
> ---------------------------------------
>
> At first glance it looks like it pattern does account for Request being
> null:
>
> // AspNetRequestPatternConverter
> protected override void Convert(TextWriter writer, LoggingEvent
> loggingEvent, HttpContext httpContext)
> {
>        if (httpContext.Request != null)
>        {
>                if (Option != null)
>                {
>                        WriteObject(writer, loggingEvent.Repository,
> httpContext.Request.Params[Option]);
>                }
>                else
>                {
>                        WriteObject(writer, loggingEvent.Repository,
> httpContext.Request.Params);
>                }
>        }
>        else
>        {
>                writer.Write(SystemInfo.NotAvailableText);
>         }
> }
>
> > AdoNetAppender errors when writing Asp.net item when Request object is
> null
> >
> ---------------------------------------------------------------------------
> >
> >                 Key: LOG4NET-331
> >                 URL: https://issues.apache.org/jira/browse/LOG4NET-331
> >             Project: Log4net
> >          Issue Type: Bug
> >          Components: Appenders
> >    Affects Versions: 1.2.11
> >         Environment: Windows Server 2008 R2
> >            Reporter: Andy Smith
> >            Priority: Minor
> >
> > When using AdoNetAppender, with a conversion pattern of
> '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during
> the Application_Start event, it throws an error (internally) and stops
> working. The error refers to "...Request is not available in this
> context.." which makes sense because its only in the Application_Start
> event. However the appender should accommodate this situation and log null,
> not throw an error. The RollingFileAppender, for instance,  handles this
> gracefully.
>
> --
> 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-331) AdoNetAppender errors when writing Asp.net item when Request object is null

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

Ron Grabowski commented on LOG4NET-331:
---------------------------------------

At first glance it looks like it pattern does account for Request being null:

// AspNetRequestPatternConverter
protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext)
{
	if (httpContext.Request != null)
	{
		if (Option != null)
		{
			WriteObject(writer, loggingEvent.Repository, httpContext.Request.Params[Option]);
		}
		else
		{
			WriteObject(writer, loggingEvent.Repository, httpContext.Request.Params);
		}
	}
	else
	{
		writer.Write(SystemInfo.NotAvailableText);
	}
}
                
> AdoNetAppender errors when writing Asp.net item when Request object is null
> ---------------------------------------------------------------------------
>
>                 Key: LOG4NET-331
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-331
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.11
>         Environment: Windows Server 2008 R2
>            Reporter: Andy Smith
>            Priority: Minor
>
> When using AdoNetAppender, with a conversion pattern of '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during the Application_Start event, it throws an error (internally) and stops working. The error refers to "...Request is not available in this context.." which makes sense because its only in the Application_Start event. However the appender should accommodate this situation and log null, not throw an error. The RollingFileAppender, for instance,  handles this gracefully.

--
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] [Resolved] (LOG4NET-331) AdoNetAppender errors when writing Asp.net item when Request object is null

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

Stefan Bodewig resolved LOG4NET-331.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.12

fixed with svn revision 1345626
                
> AdoNetAppender errors when writing Asp.net item when Request object is null
> ---------------------------------------------------------------------------
>
>                 Key: LOG4NET-331
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-331
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.11
>         Environment: Windows Server 2008 R2
>            Reporter: Andy Smith
>            Priority: Minor
>             Fix For: 1.2.12
>
>
> When using AdoNetAppender, with a conversion pattern of '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during the Application_Start event, it throws an error (internally) and stops working. The error refers to "...Request is not available in this context.." which makes sense because its only in the Application_Start event. However the appender should accommodate this situation and log null, not throw an error. The RollingFileAppender, for instance,  handles this gracefully.

--
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-331) AdoNetAppender errors when writing Asp.net item when Request object is null

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

Andy Smith updated LOG4NET-331:
-------------------------------

    Description: When using AdoNetAppender, with a conversion pattern of '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during the Application_Start event, it throws an error (internally) and stops working. The error refers to "...Request is not available in this context.." which makes sense because its only in the Application_Start event. However the appender should accommodate this situation and log null, not throw an error. The RollingFileAppender, for instance,  handles this gracefully.  (was: When using AdoNetAppender, with a conversion pattern of '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during the Application_Start event, it throws an error (internally) and stops working. The error refers to "...Request is not available in this context.." which makes sense because its only in the Application_Start event. However the appender should accommodate this situation and log null, not throw an error. The RollingFileAppender handles this fine.)
    
> AdoNetAppender errors when writing Asp.net item when Request object is null
> ---------------------------------------------------------------------------
>
>                 Key: LOG4NET-331
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-331
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.11
>         Environment: Windows Server 2008 R2
>            Reporter: Andy Smith
>            Priority: Minor
>
> When using AdoNetAppender, with a conversion pattern of '%aspnet-request{REMOTE_ADDR}', and I attempt to write a log entry during the Application_Start event, it throws an error (internally) and stops working. The error refers to "...Request is not available in this context.." which makes sense because its only in the Application_Start event. However the appender should accommodate this situation and log null, not throw an error. The RollingFileAppender, for instance,  handles this gracefully.

--
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