You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Markus Waidhofer (JIRA)" <ji...@apache.org> on 2016/11/08 12:19:58 UTC
[jira] [Updated] (LOG4J2-1682) Logger using LocalizedMessageFactory
prints key instead of messsage
[ https://issues.apache.org/jira/browse/LOG4J2-1682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Markus Waidhofer updated LOG4J2-1682:
-------------------------------------
Attachment: exampleLocalizedMessageFactory.zip
> 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}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org