[jboss-jira] [JBoss JIRA] (JBLOGGING-140) Avoid ClassCastException in Slf4jLoggerProvider

Philippe Marschall (Jira) issues at jboss.org
Tue Jul 9 03:22:00 EDT 2019


     [ https://issues.jboss.org/browse/JBLOGGING-140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philippe Marschall updated JBLOGGING-140:
-----------------------------------------
    Description: 
We use jboss-logging with a custom SLF4J implementation that does not implement {{LocationAwareLogger}}. We have exception tracing on and see a {{ClassCastException}} in {{org.jboss.logging.Slf4jLoggerProvider#getLogger(String)}} for every logger we look up.

We did some preliminary microbenchmarks and can see no differences between unconditionally casting and catching {{Throwable}} vs an {{instanceof}}, both in cases where the check succeeds and where is fails. Having said the class hierarchies we tested are slightly different from actual SLF4J class hierarchies.

  was:
We use jboss-logging with a custom SLF4J implementation that does not implement {{LocationAwareLogger}}. We have exception tracing on and see a {{ClassCastException}} in {{org.jboss.logging.Slf4jLoggerProvider#getLogger(String)}} for every logger we look up.

We did some preliminary microbenchmarks and can see no differences between unconditionally casting and catching {{Throwable}} vs an {{instanceof}}, both in cases where the check success. Having said the class hierarchies we tested are slightly different from actual SLF4J class hierarchies.



> Avoid ClassCastException in Slf4jLoggerProvider
> -----------------------------------------------
>
>                 Key: JBLOGGING-140
>                 URL: https://issues.jboss.org/browse/JBLOGGING-140
>             Project: JBoss Logging
>          Issue Type: Enhancement
>            Reporter: Philippe Marschall
>            Assignee: James Perkins
>            Priority: Major
>             Fix For: 3.4.1.Final
>
>
> We use jboss-logging with a custom SLF4J implementation that does not implement {{LocationAwareLogger}}. We have exception tracing on and see a {{ClassCastException}} in {{org.jboss.logging.Slf4jLoggerProvider#getLogger(String)}} for every logger we look up.
> We did some preliminary microbenchmarks and can see no differences between unconditionally casting and catching {{Throwable}} vs an {{instanceof}}, both in cases where the check succeeds and where is fails. Having said the class hierarchies we tested are slightly different from actual SLF4J class hierarchies.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list