You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Eric Schellhammer (JIRA)" <ji...@apache.org> on 2013/03/04 12:49:12 UTC

[jira] [Commented] (LOG4J2-167) ClassCastException from SimpleLoggerContext to core.LoggerContext, since it implements spi.LoggerContext

    [ https://issues.apache.org/jira/browse/LOG4J2-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13592143#comment-13592143 ] 

Eric Schellhammer commented on LOG4J2-167:
------------------------------------------

The exception is no longer thrown, and so the immediate problem is solved.
However, the way it is constructed now, even a valid URI parameter configLocation is effectively ignored if the default configuration fails (i.e. returns the SimpleLoggerContext). This leaves no possibility for configuration in this case, significantly reducing the features of Log4j2.

Should this be stated as a new bug or continued in this issue?


Btw: If I see it correctly, the SimpleLogger can never be used as a normal Logger for Log4j2, but only in the context of the StatusLogger. This may be the intended behaviour; if this is so, however, the class comment in SimpleLogger.java should be altered accordingly.
                
> ClassCastException from SimpleLoggerContext to core.LoggerContext, since it implements spi.LoggerContext
> --------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-167
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-167
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-beta5
>            Reporter: Eric Schellhammer
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta5
>
>
> When calling Configurator.initialize(<Name>, null, <File>) it calls LogManager.getContext(loader, false) and if no logging implementation can be found this method returns a new SimpleLoggerContext (created by the factory which in turn is created in the static part of the class). This class implements spi.LoggerContext but the Configurator tries to cast it to core.LoggerContext, which fails since SimpleLoggerContext does not extend that class.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org