Thanks Remko! would you like me to create a JIRA ticket for the same ? I could also try giving a shot at creating that unit test case for you..
Regards, -Yogesh On Sun, Aug 24, 2014 at 12:35 PM, Remko Popma <[email protected]> wrote: > This looks like a bug. The output is the FQCN (fully qualified name of the > logger). > This is probably introduced by the changes made for LOG4J2-555. > > Our unit tests are not picking this up because they use > the ch.qos.logback.classic.Logger, which is a LocationAwareLogger and > follows a different code path. > I suspect that Simple Logger is not LocationAware. > > I suspect we should change (in SLF4JLogger.logMessage) > logger.debug(fqcn, getMarker(marker), message.getFormattedMessage(), > message.getParameters(), t); > to > logger.debug(getMarker(marker), message.getFormattedMessage(), > message.getParameters(), t); > > I can change this but want to make a failing unit test first and I haven't > had time to figure out how to do that yet. > > > > On Sun, Aug 24, 2014 at 12:00 PM, Yogesh Rao <[email protected]> wrote: > > > Hi Ralph, > > > > The issue for me is log4j2 to slf4j adaptor doesnt seem to be working. I > > added the log4j configuration only when the logger wasnt working hence i > > mentioned in brackets that i wasnt sure if its needed or not.. > > > > So since you mentioned that things should be working without the > > configuration i removed it and ran but it still doesnt log the details as > > desired. > > > > Is this an issue with log4j2? > > > > Regards, > > -Yogesh > > > > On Sunday, August 24, 2014, Ralph Goers <[email protected]> > > wrote: > > > > > I am really not clear on what the issue is. It seems you have things > > > configured so that you can write to the Log4j 2 API but actually use > > SLF4J > > > for logging. There is nothing wrong with that but if you are routing > to > > > SLF4J and using SLF4J Simple Logger then the Log4j 2 configuration > won’t > > > even be used. > > > > > > What are you really wanting to do and what are you expecting to happen? > > > > > > Ralph > > > > > > On Aug 22, 2014, at 7:57 PM, Yogesh Rao <[email protected] > > <javascript:;>> > > > wrote: > > > > > > > Thanks matt! > > > > > > > > First is what i am attempting to check.. Here instead of logback i > have > > > > used slf4j-simple. > > > > > > > > Based on this is there any issue with my implementation? > > > > > > > > Regards, > > > > -Yogesh > > > > > > > > On Friday, August 22, 2014, Matt Sicker <[email protected] > > <javascript:;>> > > > wrote: > > > > > > > >> Using log4j-to-slf4j is for when you want to use log4j-api but with > an > > > >> slf4j implementation (like logback). log4j-slf4j-impl would allow > you > > to > > > >> use slf4j-api and have that log to log4j-core. > > > >> > > > >> > > > >> On 22 August 2014 08:27, Yogesh Rao <[email protected] > <javascript:;> > > > <javascript:;>> > > > >> wrote: > > > >> > > > >>> Hi, > > > >>> > > > >>> I am trying out the API side of log4j2 with the SLF4J adaptor. With > > the > > > >>> sample code written i couldn't see the logging being done properly. > > > >> Perhaps > > > >>> i am doing something wrong here. > > > >>> > > > >>> Firstly versions of the software are :- > > > >>> > > > >>> 1. JDK 1.8.x > > > >>> 2. Log4j2 (2.0.1) > > > >>> 3. SLF4J 1.7.7 > > > >>> 4. SLF4J's Simple Logger (1.7.7) > > > >>> > > > >>> Code written is as under > > > >>> > > > >>> HelloWorld.java > > > >>> -------------- > > > >>> > > > >>> import org.apache.logging.log4j.LogManager; > > > >>> import org.apache.logging.log4j.Logger; > > > >>> > > > >>> > > > >>> public class HelloWorld { > > > >>> > > > >>> private static final Logger logger = > > > LogManager.getLogger("HelloWorld"); > > > >>> public static void main(String[] args) { > > > >>> logger.error("Hello, World!"); > > > >>> logger.error("Logging in user {} with birthday {}", "Ted", > > > >>> "1/10/1900"); > > > >>> } > > > >>> > > > >>> } > > > >>> > > > >>> Log4j.xml (Not sure if this is needed or not) > > > >>> ------------- > > > >>> > > > >>> <?xml version="1.0" encoding="UTF-8"?> > > > >>> <Configuration status="WARN"> > > > >>> <Appenders> > > > >>> <Console name="Console" target="SYSTEM_OUT"> > > > >>> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level > > %logger{36} > > > >> - > > > >>> %msg%n"/> > > > >>> </Console> > > > >>> </Appenders> > > > >>> <Loggers> > > > >>> <Root level="INFO"> > > > >>> <AppenderRef ref="Console"/> > > > >>> </Root> > > > >>> </Loggers> > > > >>> </Configuration> > > > >>> > > > >>> > > > >>> The output generated is > > > >>> ----------------------------- > > > >>> [main] ERROR HelloWorld - > org.apache.logging.log4j.spi.AbstractLogger > > > >>> [main] ERROR HelloWorld - > org.apache.logging.log4j.spi.AbstractLogger > > > >>> > > > >>> Jars in classpath > > > >>> ---------------------- > > > >>> log4j-api-2.0.1.jar > > > >>> log4j-to-slf4j-2.0.1.jar > > > >>> slf4j-api-1.7.7 > > > >>> slf4j-simple-1.7.7 > > > >>> > > > >>> > > > >>> Also the code works fine if i remove the slf4j related jars and > > replace > > > >> it > > > >>> with log4j core. > > > >>> > > > >>> Is there any configuration that i have missed ? > > > >>> > > > >>> Thank You! > > > >>> > > > >>> Regards, > > > >>> -Yogesh > > > >>> > > > >> > > > >> > > > >> > > > >> -- > > > >> Matt Sicker <[email protected] <javascript:;> <javascript:;>> > > > >> > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > <javascript:;> > > > For additional commands, e-mail: [email protected] > > > <javascript:;> > > > > > > > > >
