uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Eckart de Castilho (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-2374) Log4jLogger_impl always logs wrapper class name instead of caller class name
Date Sun, 06 May 2012 11:19:49 GMT

    [ https://issues.apache.org/jira/browse/UIMA-2374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269182#comment-13269182

Richard Eckart de Castilho commented on UIMA-2374:

The Log4J log call that is used here is explicitly for logging frameworks that wrap Log4j.
The first argument is the name of the wrapping logger class. When Log4j calculates the calling
class, it will unwind the stack trace up to the first entry with this class name and then
unwind one more. The effect is that none of the classes that belong to the logging framework
or to the logging wrapper classes show up in the logged stack trace. Also the logged class
and line number information will point to the correct line in the user code instead of pointing
to a line in the logging wrapper.

So it is correct to pass the name of the wrapper class as the first argument. The [Log4j documentation|http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#log(java.lang.String,%20org.apache.log4j.Priority,%20java.lang.Object,%20java.lang.Throwable)]

public void log(String callerFQCN,
                Priority level,
                Object message,
                Throwable t)

This is the most generic printing method. It is intended to be invoked by wrapper classes.

    callerFQCN - The wrapper class' fully qualified class name.
    level - The level of the logging request.
    message - The message of the logging request.
    t - The throwable of the logging request, may be null.
> Log4jLogger_impl always logs wrapper class name instead of caller class name
> ----------------------------------------------------------------------------
>                 Key: UIMA-2374
>                 URL: https://issues.apache.org/jira/browse/UIMA-2374
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.4.0SDK
>            Reporter: Richard Eckart de Castilho
>            Priority: Minor
>              Labels: patch
>             Fix For: 2.4.1SDK
>         Attachments: UIMA-2374-REC-2012-02-20.patch
> When enabling classname/filename logging in Log4J, Log4jLogger_impl currently will allways
log the  Log4jLogger_impl class/file instead of the name of the caller. This can be fixed
by using the Log4J methods intended for use by logger wrappers.

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


View raw message