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 "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/12/15 01:19:58 UTC
[jira] [Updated] (LOG4J2-1682) Logger using LocalizedMessageFactory
prints key instead of message
[ https://issues.apache.org/jira/browse/LOG4J2-1682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary Gregory updated LOG4J2-1682:
---------------------------------
Summary: Logger using LocalizedMessageFactory prints key instead of message (was: Logger using LocalizedMessageFactory prints key instead of messsage)
> Logger using LocalizedMessageFactory prints key instead of message
> ------------------------------------------------------------------
>
> 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
> Assignee: Gary Gregory
> Fix For: 2.8
>
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org