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

Markus Waidhofer updated LOG4J2-1682:
-------------------------------------
    Description: 
I am having a problem when logging localized messages. I use a Logger with the 
LocalizedMessageFactory. However, everytime I pass the message key to the 
logger, it prints the key itself instead of the message. If I pass additional 
arguments to the logging method, the key gets translated correctly to the 
message.

Example:

{code}
public class Showcase {
    private static Logger logger = LogManager.getLogger(Showcase.class, new 
LocalizedMessageFactory("messages"));

    public static void main(String... args) {
        logger.info("key.test"); // logs "key.test"
        logger.info("key.test", ""); // prints message correctly
    }
}
{code}

See attached project for a working example.

  was:
I am having a problem when logging localized messages. I use a Logger with the 
LocalizedMessageFactory. However, everytime I pass the message key to the 
logger, it prints the key itself instead of the message. If I pass additional 
arguments to the logging method, the key gets translated correctly to the 
message.

Example:

{code}
public class Showcase {
    private static Logger logger = LogManager.getLogger(Showcase.class, new 
LocalizedMessageFactory("messages"));

    public static void main(String... args) {
        logger.info("key.test"); // logs "key.test"
        logger.info("key.test", ""); // prints message correctly
    }
}
{code}


> Logger using LocalizedMessageFactory prints key instead of messsage
> -------------------------------------------------------------------
>
>                 Key: LOG4J2-1682
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1682
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.7
>            Reporter: Markus Waidhofer
>         Attachments: exampleLocalizedMessageFactory.zip
>
>
> I am having a problem when logging localized messages. I use a Logger with 
> the LocalizedMessageFactory. However, everytime I pass the message key to the 
> logger, it prints the key itself instead of the message. If I pass additional 
> arguments to the logging method, the key gets translated correctly to the 
> message.
> Example:
> {code}
> public class Showcase {
>     private static Logger logger = LogManager.getLogger(Showcase.class, new 
> LocalizedMessageFactory("messages"));
>     public static void main(String... args) {
>         logger.info("key.test"); // logs "key.test"
>         logger.info("key.test", ""); // prints message correctly
>     }
> }
> {code}
> See attached project for a working example.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to