From 7b2889665d790585f4e1e0ac5c215359240a8d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 13 Mar 2017 08:48:57 +0100 Subject: java : vaadin : add logback support --- java/vaadin/ivy.xml | 2 + java/vaadin/src/main/java/ch/asynk/HelloWorld.java | 13 ++++++ .../src/main/resources/Application.properties | 2 + java/vaadin/src/main/resources/logback-test.xml | 48 ++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 java/vaadin/src/main/resources/logback-test.xml diff --git a/java/vaadin/ivy.xml b/java/vaadin/ivy.xml index 033e347..7be4e62 100644 --- a/java/vaadin/ivy.xml +++ b/java/vaadin/ivy.xml @@ -16,5 +16,7 @@ + + diff --git a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java index 65ef27d..e811599 100644 --- a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java +++ b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java @@ -11,14 +11,20 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + @Title("Hello!!") @Theme("valo") public class HelloWorld extends UI { private static final long serialVersionUID = 511085335415683713L; + private static Logger logger = null; + @Override protected void init(VaadinRequest request) { + logger = LoggerFactory.getLogger(this.getClass()); VerticalLayout content = new VerticalLayout(); setContent(content); @@ -28,6 +34,13 @@ public class HelloWorld extends UI @Override public void buttonClick(ClickEvent event) { Notification.show("Pushed!"); + System.out.println("System.out"); + System.err.println("System.err"); + logger.trace("trace"); + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); } })); } diff --git a/java/vaadin/src/main/resources/Application.properties b/java/vaadin/src/main/resources/Application.properties index 193ca7f..512362b 100644 --- a/java/vaadin/src/main/resources/Application.properties +++ b/java/vaadin/src/main/resources/Application.properties @@ -1,3 +1,5 @@ app.name=VaadinHelloWorld app.version=0.0.1 app.path=/hello +app.env=DEV +app.logfile=/var/log/tomcat7/HelloWorld.log diff --git a/java/vaadin/src/main/resources/logback-test.xml b/java/vaadin/src/main/resources/logback-test.xml new file mode 100644 index 0000000..4c53061 --- /dev/null +++ b/java/vaadin/src/main/resources/logback-test.xml @@ -0,0 +1,48 @@ + + + HelloWorld + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${LOG_PATTERN} + + + + + ${LOG_FILE} + + ${LOG_PATTERN} + + + + + + + + -- cgit v1.1-2-g2b99