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

vaibhav singh commented on LOG4J2-1832:
---------------------------------------

Thanks for the prompt reply. As you pointed out, there was a mismatch between 
the rolling file appender name and its corresponding reference, which I fixed. 
I have also made additivity=false as I don't want to use root logger but the 
logger which I configured. I am now using the Logger "logger" to log to file.

I am still not able to see class names in the log. Instead of the class name I 
see a "?", and I don't really understand why.

On a side note, how is it that the logger is able to know the caller class 
name? Is it through Reflection, or are some Thread shenanigans used?

Log test class:
http://pastebin.com/yBQ7mGPC

Output:
http://pastebin.com/cnfnqauz

> Programmatical Configuration of Log4j2 with RollingFileAppender does not 
> honor logging classnames
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1832
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1832
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Configurators
>    Affects Versions: 2.7
>         Environment: Ubuntu 16.04
>            Reporter: vaibhav singh
>              Labels: beginner, features
>             Fix For: boot-1.0-alpha1
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> I am trying to programmatically configure a Log4j2 logger with a Rolling File 
> appender, and am seeing that classnames are not getting printed according to 
> the Layouts page(https://logging.apache.org/log4j/2.x/manual/layouts.html)
> Can someone please help me understand why is it that the classname is not 
> getting printed? Is it an existing bug with PatternLayout class?
> Test class:
> http://pastebin.com/yBQ7mGPC
> Output:
> http://pastebin.com/cnfnqauz



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to