Hi Sriram,

It seems like the fact that we are using a bridge class confuses Slf4j or
log4j about the actual invoking code... See related discussion with
workarounds:
http://stackoverflow.com/questions/1486233/java-logging-show-the-source-line
-number-of-the-caller-not-the-logging-helper-m

You might have more success using the Slf4j bridge from JDK's logging
instead. Just note that it has a higher performance cost that the Restlet's
logger facade:

   import org.slf4j.bridge.SLF4JBridgeHandler;
   SLF4JBridgeHandler.install();

Otherwise, I've entered a bug report:

"Slf4j bridge reports wrong line number and caller class in log4j"
http://restlet.tigris.org/issues/show_bug.cgi?id=1046

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.org
Noelios Technologies ~ http://www.noelios.com





-----Message d'origine-----
De : Sriram C [mailto:[email protected]] 
Envoyé : mardi 9 février 2010 01:14
À : [email protected]
Objet : restlet 2.0, spring 3.0 and log4j 1.2.15

Hi,
I am trying to use the org.restlet.ext.slf4j.Slf4jLogger to send the log
messages to a log4j controlled output.

I can see the Spring messages in the log with the right Class and line
numbers. However all the restlet class name and line number are from the
Slf4jLogger class. Can someone please help me in figuring out config I am
missing in my setup.

The relevant jar files in my web app are: org.restlet.ext.slf4j.jar,
slf4j-api-1.5.10.jar, slf4j-log4j12-1.5.10.jar , log4j-1.2.15.jar.

I am passing
-Dorg.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFaca
de
to my jvm startup. 



The messages are of the form:

TRACE [16:07:17,556] - org.restlet.ext.slf4j.Slf4jLogger.finer(105) |
Attempting to match this pattern: /MyJAXRSServices/rest >> 22
DEBUG [16:07:17,557] - org.restlet.ext.slf4j.Slf4jLogger.fine(93) | New base
URI: http://localhost:8080/MyJAXRSServices/rest
DEBUG [16:07:17,558] - org.restlet.ext.slf4j.Slf4jLogger.fine(93) | New
remaining part: /customer/
DEBUG [16:07:17,558] - org.restlet.ext.slf4j.Slf4jLogger.fine(93) |
Delegating the call to the target Restlet
DEBUG [16:07:17,572] -
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(241)
| Returning cached instance of singleton bean 'customerService'
DEBUG [16:07:29,329] -
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(241)
| Returning cached instance of singleton bean
'org.springframework.transaction.interceptor.TransactionInterceptor#0'
DEBUG [16:07:29,337] -
org.springframework.transaction.interceptor.AbstractFallbackTransactionAttri
buteSource.getTransactionAttribute(106)
| Adding transactional method [save] with attribute
[PROPAGATION_REQUIRED,ISOLATION_DEFAULT]
etc ..

Thanks
Sriram
-- 
View this message in context:
http://n2.nabble.com/restlet-2-0-spring-3-0-and-log4j-1-2-15-tp4538052p45380
52.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24460
19

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2452493

Reply via email to