Foren
Vaadin portlet and logging
Sebastian Wikholm, geändert vor 10 Jahren.
Vaadin portlet and logging
Regular Member Beiträge: 104 Beitrittsdatum: 10.03.11 Neueste Beiträge
Ive been trying to get my vaadin portlets to output anything to its own logfiles, liferays or tomcats logfiles, but i just cant get it to work. Ive been looking around a lot of guides how to enable logging, but i just cant get it to work.
Every guide I find is in some form incomplete, example:
https://vaadin.com/book/vaadin7/-/page/advanced.logging.html
They write: "The basic way to go about this is to add the SLF4J JAR file as well as the jul-to-slf4j.jar file, which implements the bridge from java.util.logging, to SLF4J. "
Well there is not one "SLF4j.JAR" file but there are 25 .jar files in the .zip file you download from http://www.slf4j.org/
So its all a bit of quesswork, and none of my guesses have been right yet..
Any help would be really appreciated, maybe an empty liferay vaadin project with the files needed for logging with working configurations in them?
Every guide I find is in some form incomplete, example:
https://vaadin.com/book/vaadin7/-/page/advanced.logging.html
They write: "The basic way to go about this is to add the SLF4J JAR file as well as the jul-to-slf4j.jar file, which implements the bridge from java.util.logging, to SLF4J. "
Well there is not one "SLF4j.JAR" file but there are 25 .jar files in the .zip file you download from http://www.slf4j.org/
So its all a bit of quesswork, and none of my guesses have been right yet..
Any help would be really appreciated, maybe an empty liferay vaadin project with the files needed for logging with working configurations in them?
David H Nebinger, geändert vor 10 Jahren.
RE: Vaadin portlet and logging
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Vaadin will use SLF4j, but I've always had success just using log4j.jar to get my own logging context. Combine that with a log4j properties or xml file, and you should be good to go.
Note that even when doing Vaadin, you must remember you're still creating a portlet. So the portlet rules will trump Vaadin rules, especially when it comes to jars. So on the portlet side, you're going to use liferay-plugin-package.properties file to add dependencies for jars you want to pull in from the portal such as slf4j and others. Only when a jar is not available from the portal do you try to import a jar from your own WEB-INF/lib directory.
Note that even when doing Vaadin, you must remember you're still creating a portlet. So the portlet rules will trump Vaadin rules, especially when it comes to jars. So on the portlet side, you're going to use liferay-plugin-package.properties file to add dependencies for jars you want to pull in from the portal such as slf4j and others. Only when a jar is not available from the portal do you try to import a jar from your own WEB-INF/lib directory.
Jack Bakker, geändert vor 10 Jahren.
RE: Vaadin portlet and logging
Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
I use same pattern for logging in portlets whether MVC or Vaadin. Like:
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
private static Log _log = LogFactoryUtil
.getLog(MyPortletApplication.class);
_log.info(...)
_log.error(...)
_log.debug(...)
am I missing soething ?
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
private static Log _log = LogFactoryUtil
.getLog(MyPortletApplication.class);
_log.info(...)
_log.error(...)
_log.debug(...)
am I missing soething ?
David H Nebinger, geändert vor 10 Jahren.
RE: Vaadin portlet and logging
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
No, Jack, you're not missing anything, Liferay logging is perfectly acceptable even in a Vaadin portlet.
Jack Bakker, geändert vor 10 Jahren.
RE: Vaadin portlet and logging
Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
Thanks for clarifying David.