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 "Dominik Psenner (JIRA)" <ji...@apache.org> on 2012/07/30 08:17:33 UTC

[jira] [Created] (LOG4NET-350) Support HttpContextBase as a replacement of the HttpContext class in AspNetPatternLayoutConverter

Dominik Psenner created LOG4NET-350:
---------------------------------------

             Summary: Support HttpContextBase as a replacement of the HttpContext class in AspNetPatternLayoutConverter
                 Key: LOG4NET-350
                 URL: https://issues.apache.org/jira/browse/LOG4NET-350
             Project: Log4net
          Issue Type: Improvement
          Components: Appenders
         Environment: Any
            Reporter: Dominik Psenner
            Priority: Minor


-- quote "George Chung [george at glympse dot com]" --
It currently defines this abstract method:

protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext)

I would recommend changing it to:

protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContextBase httpContext)

Effectively, HttpContext.Current is not very useful anymore in more recent versions of ASP.NET. As they are promoting an asynchronous programming model where operations complete on completion threads. And they also encourage the use of the ParallelTaskLibrary for queuing work items. The bulk of your operations are going to execute on these threads, and on these threads, HttpContext.Current is null.

HttpContextBase is what's being used now and it's easy to convert HttpContext.Current to an HttpContextBase like this:

new HttpContextWrapper(HttpContext.Current)

Here's some more info on the matter.

http://www.splinter.com.au/httpcontext-vs-httpcontextbase-vs-httpcontext/
-- /quote --

--
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-350) Support HttpContextBase as a replacement of the HttpContext class in AspNetPatternLayoutConverter

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

Jaap Taal commented on LOG4NET-350:
-----------------------------------

Maybe add an overload for it
An for the other method use the wrapper implementation that inherits from HttpContextBase and wraps the HttpContext instance?
                
> Support HttpContextBase as a replacement of the HttpContext class in AspNetPatternLayoutConverter
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-350
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-350
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Appenders
>         Environment: Any
>            Reporter: Dominik Psenner
>            Priority: Minor
>
> -- quote "George Chung [george at glympse dot com]" --
> It currently defines this abstract method:
> protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext)
> I would recommend changing it to:
> protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContextBase httpContext)
> Effectively, HttpContext.Current is not very useful anymore in more recent versions of ASP.NET. As they are promoting an asynchronous programming model where operations complete on completion threads. And they also encourage the use of the ParallelTaskLibrary for queuing work items. The bulk of your operations are going to execute on these threads, and on these threads, HttpContext.Current is null.
> HttpContextBase is what's being used now and it's easy to convert HttpContext.Current to an HttpContextBase like this:
> new HttpContextWrapper(HttpContext.Current)
> Here's some more info on the matter.
> http://www.splinter.com.au/httpcontext-vs-httpcontextbase-vs-httpcontext/
> -- /quote --

--
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-350) Support HttpContextBase as a replacement of the HttpContext class in AspNetPatternLayoutConverter

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

Dominik Psenner commented on LOG4NET-350:
-----------------------------------------

Replacing HttpContext with HttpContextBase is not a good idea since HttpContext is not a subclass of HttpContextBase. It would break backwards-compatibility against all subclasses of AspnetPatternLayoutConverter.
                
> Support HttpContextBase as a replacement of the HttpContext class in AspNetPatternLayoutConverter
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-350
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-350
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Appenders
>         Environment: Any
>            Reporter: Dominik Psenner
>            Priority: Minor
>
> -- quote "George Chung [george at glympse dot com]" --
> It currently defines this abstract method:
> protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext)
> I would recommend changing it to:
> protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContextBase httpContext)
> Effectively, HttpContext.Current is not very useful anymore in more recent versions of ASP.NET. As they are promoting an asynchronous programming model where operations complete on completion threads. And they also encourage the use of the ParallelTaskLibrary for queuing work items. The bulk of your operations are going to execute on these threads, and on these threads, HttpContext.Current is null.
> HttpContextBase is what's being used now and it's easy to convert HttpContext.Current to an HttpContextBase like this:
> new HttpContextWrapper(HttpContext.Current)
> Here's some more info on the matter.
> http://www.splinter.com.au/httpcontext-vs-httpcontextbase-vs-httpcontext/
> -- /quote --

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