You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Mounica Kodela (JIRA)" <ji...@apache.org> on 2017/09/13 07:45:01 UTC
[jira] [Comment Edited] (LOG4J2-1921) Getting ClassCastException
while getting LoggerContext
[ https://issues.apache.org/jira/browse/LOG4J2-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16164258#comment-16164258 ]
Mounica Kodela edited comment on LOG4J2-1921 at 9/13/17 7:44 AM:
-----------------------------------------------------------------
[~ralph_goers@dslextreme.com] We do not have the exact issue. We have an issue using 2.9.0 for our android application which i reported in LOG4J2-2038
Previously, we were using 2.3. We have a problem with oreo devices with v2.3 which is resolved in 2.9.0 as per the status of LOG4J2-1920. So, we need to use 2.9.0 to avoid crashing for Android oreo devices. We need help to resolve this.
Thanks,
Mounica
was (Author: mounicakodela):
[~ralph_goers@dslextreme.com] We do not have the exact issue. We have an issue using 2.9.0 for our android application which i reported in LOG4J2-2038
Previously, we were using 2.3. We have a problem with oreo devices with v2.3 which is resolved in 2.9.0 as per the resolution of LOG4J2-1920. So, we need to use 2.9.0 to avoid crashing for Android oreo devices. We need help to resolve this.
Thanks,
Mounica
> Getting ClassCastException while getting LoggerContext
> ------------------------------------------------------
>
> Key: LOG4J2-1921
> URL: https://issues.apache.org/jira/browse/LOG4J2-1921
> Project: Log4j 2
> Issue Type: Bug
> Components: Configurators
> Affects Versions: 2.8.2
> Environment: Android
> Reporter: Ajitha
> Priority: Blocker
> Labels: Android
> Attachments: Log4jExample_using_v2.3.zip
>
>
> Hi,
> I integrated the log4j with my Android application and did the initial config. It works fine. I have a menu item in "Settings" screen where I can change the log levels in my application. So, After I change the configuration, I need to update the loggers. So I am using following logic.
> {code:java}
> LoggerContext ctx = LoggerContext.getContext()
> Configuration config = ctx.getConfiguration();
> LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
> loggerConfig.setLevel(myLogLevel);
> ctx.updateLoggers();
> {code}
> While getting the logger context, I am getting a ClassCastException.
> 05-26 22:33:21.011 E/AndroidRuntime( 9642): Caused by: java.lang.ClassCastException: org.apache.logging.log4j.simple.SimpleLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext
> 05-26 22:33:21.011 E/AndroidRuntime( 9642): at org.apache.logging.log4j.core.LoggerContext.getContext(LoggerContext.java:190)
> 05-26 22:33:21.011 E/AndroidRuntime( 9642): at org.apache.logging.log4j.core.config.Configurator.setRootLevel(Configurator.java:323)
> Please help here.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)