Jan Eerdekens Il y a 10 années I got this to work for the most part, but can't seem to get MDC to work. I add values to the MDC and use a pattern that should print them, but no values get printed, but the rest of the log line does. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Jan Eerdekens Il y a 10 années Hi Jan,happy to hear that you tryied and it works. I can confirm that MDC(Mapped Diagnostic Context) doesn't work using Liferay Logging Framework SLF4J Adapter (util-slf4j.jar). Looking at source code of org.slf4j.impl.StaticMDCBinder (https://github.com/liferay/liferay-portal/blob/6.2.0-ga1/util-slf4j/src/org/slf4j/impl/StaticMDCBinder.java) it returns a BasicMDCAdapter and as BasicMDCAdapter javadoc reports "can be used with logging systems that lack out-of-the-box MDC support". It seems it's still an unsupported feature.I've just seen, commented and voted your reported https://issues.liferay.com/browse/LPS-44869. Thanks,Denis. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Denis Signoretto Il y a 10 années As Jan reported in https://issues.liferay.com/browse/LPS-44869 switching to slf4j-log4j12 MDC works as expected. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Jan Eerdekens Denis Signoretto Il y a 10 années I tried some (very) quick debugging yesterday and found that stuff got put into the MDC correctly, but when the log message is being formatted the values aren't there anymore. Didn't have the time yet to delve in deeper to see what causes it. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Jan Eerdekens Il y a 10 années - Edité I opened a feature request to add MDC (Mapped Diagnostic Context) support to Liferay Logging API (https://issues.liferay.com/browse/LPS-44900) and extend it to SLF4J Adapter (https://issues.liferay.com/browse/LPS-44869). Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Denis Signoretto Jan Eerdekens Il y a 10 années Hi Jan,happy to hear that you tryied and it works. I can confirm that MDC(Mapped Diagnostic Context) doesn't work using Liferay Logging Framework SLF4J Adapter (util-slf4j.jar). Looking at source code of org.slf4j.impl.StaticMDCBinder (https://github.com/liferay/liferay-portal/blob/6.2.0-ga1/util-slf4j/src/org/slf4j/impl/StaticMDCBinder.java) it returns a BasicMDCAdapter and as BasicMDCAdapter javadoc reports "can be used with logging systems that lack out-of-the-box MDC support". It seems it's still an unsupported feature.I've just seen, commented and voted your reported https://issues.liferay.com/browse/LPS-44869. Thanks,Denis. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Denis Signoretto Il y a 10 années As Jan reported in https://issues.liferay.com/browse/LPS-44869 switching to slf4j-log4j12 MDC works as expected. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Jan Eerdekens Denis Signoretto Il y a 10 années I tried some (very) quick debugging yesterday and found that stuff got put into the MDC correctly, but when the log message is being formatted the values aren't there anymore. Didn't have the time yet to delve in deeper to see what causes it. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Denis Signoretto Denis Signoretto Il y a 10 années As Jan reported in https://issues.liferay.com/browse/LPS-44869 switching to slf4j-log4j12 MDC works as expected. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Jan Eerdekens Denis Signoretto Il y a 10 années I tried some (very) quick debugging yesterday and found that stuff got put into the MDC correctly, but when the log message is being formatted the values aren't there anymore. Didn't have the time yet to delve in deeper to see what causes it. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Denis Signoretto Jan Eerdekens Il y a 10 années - Edité I opened a feature request to add MDC (Mapped Diagnostic Context) support to Liferay Logging API (https://issues.liferay.com/browse/LPS-44900) and extend it to SLF4J Adapter (https://issues.liferay.com/browse/LPS-44869). Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
abdo koptan Il y a 9 années Hi Denis, I have follow you steps but it's not working for me, i am using liferay 6.1 - Jboss 7.1Thank you Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Eric Soucy Il y a 9 années How would you log from a managedbean in a jsf portlet?what import statements are needed ? Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Eric Soucy Il y a 9 années Hi,It's working partially for me, I see my log output in the console, and in the liferay.log filemy custom rolling appender file gets created but my logout output is not in the file.I do see other lines being logged in the file, but not the ones I logged from my managed bean. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Eric Soucy Il y a 9 années Hi Eric,it seems, you have setup correclty the Liferay logging system to log on a separate file but you are not sending log to Liferay logging system. Check your slf4j imports in your class and use an slf4j Logger instance for logging.import org.slf4j.Logger;import org.slf4j.LoggerFactory;You can find a working slf4j sample portlet here: https://github.com/denissignoretto/slf4j-logging-sample-portletHope it can help!Denis. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Denis Signoretto Eric Soucy Il y a 9 années Hi Eric,it seems, you have setup correclty the Liferay logging system to log on a separate file but you are not sending log to Liferay logging system. Check your slf4j imports in your class and use an slf4j Logger instance for logging.import org.slf4j.Logger;import org.slf4j.LoggerFactory;You can find a working slf4j sample portlet here: https://github.com/denissignoretto/slf4j-logging-sample-portletHope it can help!Denis. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Thomas Hii Il y a 9 années Hi Denis,The example is working great for Liferay 6.2 running on Tomcat. However when I tried it with Liferay 6.2 running on JBoss 7 or JBoss EAP 6, the log file is created but nothing is written to it. Any idea on what might cause this problem? Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Thomas Hii Thomas Hii Il y a 9 années Finally figured out that the problem is due to JBoss class loading. By default, JBoss always load its version of log4j and slf4j. These need to be excluded via the jboss-deployment-structure.xml file. App Manager seems to generate this file during deployment, but org.slf4j is not in the exclusion list. After adding org.slf4j, the custom logging works nicely on JBoss 7.1 and JBoss EAP 6.2. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Thomas Hii Il y a 9 années Hi Tomas,thanks for sharing this info! Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Thomas Hii Thomas Hii Il y a 9 années Finally figured out that the problem is due to JBoss class loading. By default, JBoss always load its version of log4j and slf4j. These need to be excluded via the jboss-deployment-structure.xml file. App Manager seems to generate this file during deployment, but org.slf4j is not in the exclusion list. After adding org.slf4j, the custom logging works nicely on JBoss 7.1 and JBoss EAP 6.2. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Thomas Hii Il y a 9 années Hi Tomas,thanks for sharing this info! Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Denis Signoretto Thomas Hii Il y a 9 années Hi Tomas,thanks for sharing this info! Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Alberto de Francisco Martín Il y a 8 années Hi, DenisThank you Denis for the information.ThanksAlberto de Francisco Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Nagendra Kumar Busam Il y a 8 années Thank you very much sharing details. In your portlet you are using slf4j - where does Liferay's slf4j layer came in? Veuillez vous identifier pour voter. Répondre en tant que ... Annuler Denis Signoretto Nagendra Kumar Busam Il y a 8 années Hi Nagendra,Liferay SLF4J layer came in with util-slf4j.jar bridge that implement the slf4j logging adapter for Liferay logging interface. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
Denis Signoretto Nagendra Kumar Busam Il y a 8 années Hi Nagendra,Liferay SLF4J layer came in with util-slf4j.jar bridge that implement the slf4j logging adapter for Liferay logging interface. Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
parikshit sharma Il y a 8 années Hi Denis,As per your blog I am trying to implement the logs for custom portlet on bundled JBOSS server 7.1.1, but it's generating the blank log file, could you please guide me what I am missing. Below are the configurations I have done to implement it.1.Added the dependencies for slf4j-api.jar and util-slf4j.jar file in pom.xml.2.If I add the log4j.jar dependency in pom.xml , at the time of deployment it raise below exception. java.lang.ClassCastException: org.apache.log4j.EnhancedPatternLayout cannot be cast to org.apache.log4j.LayoutI searched for it , and found that by adding the log4j.jar in portlet I am initializing it again, as it is already initialized by JBOSS. So I added below configurationAdded jboss-deployment-structure.xml ,with below configuration <exclusions> <module name="javaee.api"></module> <module name="org.apache.log4j"></module> <module name="org.slf4j"></module> <module name="org.slf4j.impl"></module> <module name="org.jboss.logging"></module> <module name="org.jboss.logging.jul-to-slf4j-stub"></module> <module name="org.jboss.logmanager"></module> <module name="org.jboss.logmanager.log4j"></module> </exclusions>But still it raise the same exception.Thanks.Parikshit Veuillez vous identifier pour voter. Répondre en tant que ... Annuler
sandeep g Il y a 8 années It is also not working for me on jboss EAP 6.2. I have excluded all the modules still no luck.<exclusions> <module name="javaee.api" /> <module name="org.apache.log4j" /> <module name="org.apache.commons.logging" /> <module name="org.jboss.logging" /> <module name="org.jboss.logging.jul-to-slf4j-stub" /> <module name="org.jboss.logmanager" /> <module name="org.jboss.logmanager.log4j" /> <module name="org.slf4j" /> <module name="org.slf4j.impl" /> </exclusions> Veuillez vous identifier pour voter. Répondre en tant que ... Annuler