logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Vasileff (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LOG4J2-51) ClassCastException in Category logger
Date Mon, 19 Sep 2011 01:14:09 GMT

     [ https://issues.apache.org/jira/browse/LOG4J2-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

John Vasileff updated LOG4J2-51:

    Attachment: 0002-fix-for-Category.getInstance-returning-cached-Logger.patch

Patch to fix the problem.  Commit notes:

fix for Category.getInstance returning cached Logger

When creating new Category instances, the Category class passed a custom
Factory to context.getLogger(factory, name).  The factory created loggers of
type CategoryFactory.CategoryLogger, and code in the Category class casted the
logger to this type.

The problem was that context.getLogger(factory, name) only uses the provided
factory if it has to create a new logger.  Cached loggers would simply be
returned.  If the cached logger was created using a different factory, it was
not of type CategoryFactory.CategoryLogger and a ClassCastException would occur
during operations that called isEnabledFor or forcedLog.

> ClassCastException in Category logger
> -------------------------------------
>                 Key: LOG4J2-51
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-51
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: log4j 1.2 emulation
>            Reporter: John Vasileff
>            Priority: Blocker
>         Attachments: 0001-add-test-for-Category-when-using-a-log4j2-Logger.patch, 0002-fix-for-Category.getInstance-returning-cached-Logger.patch,
> When a Category is "created" with the same name as a previously created log4j2 Logger,
a ClassCastException occurs when calling category.l7dlog(...) and others.
> See LOG4J2-50 for additional symptoms.

This message is automatically generated by JIRA.
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

View raw message