logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: Problem using LocalizedMessageFactory: Logger prints key instead of messsage
Date Tue, 08 Nov 2016 08:32:21 GMT
Not sure if this is a bug or not but the described behavior sounds surprising...
Would you mind creating a JIRA ticket for this?

Sent from my iPhone

> On 8 Nov 2016, at 16:20, Markus Waidhofer <markuswai@aon.at> wrote:
> 
> Hi,
> 
> 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:
> 
> 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
>     }
> }
> 
> I'm not sure whether I do not use it correctly or if I hit a bug. Can you help me, please?
> 
> See attachment for a working example.
> 
> Best regards
> Markus
> 
> <exampleLocalizedMessageFactory.zip>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message