If I'm not wrong, using - Object[] - or the variable list - Object... - is a
bit different and in order to have the correct method, you should write
this:

        LOGGER.debug("Hi {} {} {}", new Object[] { arg1, arg2, arg3 });
     


MARCO BRESCIANI
ALCATEL-LUCENT
SENIOR SW CRAFT TERMINAL DEVELOPMENT ENG
NETWORKS – IP DIVISION
WT PRODUCT UNIT
via Trento, 30 – 20059 Vimercate (MB) – Italy
Phone: +39 039 686 6279 
Fax: +39 039 686 5600
[email protected]

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Stein, Eric
Sent: Monday, February 06, 2012 1:59 PM
To: [email protected]
Subject: [logback-user] Compiler selecting wrong Logger method

I'm seeing a funny error when trying to write to logback. 
        import org.slf4j.Logger;
        import org.slf4j.LoggerFactory;

        final String arg1 = "arg1";
        final String arg2 = "arg2";
        final String arg3 = "arg3";
        LOGGER.debug("Hi {} {}", arg1, arg2);
        LOGGER.debug("Hi {} {} {}", new String[] { arg1, arg2, arg3 });
        LOGGER.debug("Hi {} {} {}", arg1, arg2, arg3);
     
The last line is giving this error message:

The method debug(Marker, String, Object, Object) in the type Logger is
not applicable for the arguments (String, String, String, String)

I don't see why it isn't using the method whose signature is
debug(String, Object[]), especially given that I'm not using a Marker.
I'm running in Eclipse Indigo, and my classpath looks like this:

logback-classic-1.0.0.jar
logback-core-1.0.0.jar
slf4j-api-1.6.4.jar

Does anybody know why the compiler is using the wrong method?

Thanks,
Eric Stein
_________________________________________________
Don't gamble with your environmental information. Learn how the world's
largest on-demand environmental information management system can help you
mitigate your operating risk: www.locustec.com.

_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to