Szdnez
Szdnez

Reputation: 69

How to configure generell logging for Vaadin server and client side?

I have some mysterious behavior in my Vaadin application (randomly I get a white browser window). Therefore I want to activate logging in general for client and server side to hopefully detect some helpful hints, what the problem is. To activate logging for client side (GWT) I found something like this, which must be placed in widgetset.gwt.xml:

<inherits name="com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
<set-property name="gwt.logging.logLevel" value="INFO"/> <!-- SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST -->
<set-property name="gwt.logging.enabled" value="TRUE"/>

But when I start the app and something should be logged I can only see an error message:

com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/widgetsets/myApplication.vaadin.widgetset.MyApplicationWidgetset/remote_logging] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

For server side logging I found:

com.Vaadin=FINER

But where I have to place it? As far as I know Vaadin uses Java loggers. I am using log4j. But it should be possible to log with a Java logger into a log4j logger, or? At the end, I want to have an application with a lot of loggings on client and server side into my log4j logfile.

Thanks a lot

Upvotes: 0

Views: 1140

Answers (3)

Szdnez
Szdnez

Reputation: 69

I was also able to activate logging for Vaadin and Atmosphere server side. First of all it must be com.vaadin instaed of com.Vaadin. I also head the problem to configure JUL, because I am not using JUL somewhere else. I did it like this in a quick and dirty way:

final String julConfiguration = String.join( " \n",
        "handlers = java.util.logging.FileHandler",
        "java.util.logging.FileHandler.limit = 99999999",
        "java.util.logging.FileHandler.count = 20",
        "java.util.logging.FileHandler.pattern = /<path>/java_util_logging_%u_%g.log",
        "com.vaadin.level = ALL",
        "org.atmosphere.level = ALL"
);

final BufferedInputStream inputStream = new BufferedInputStream(
        new ReaderInputStream( new StringReader( julConfiguration ) ) );
LogManager.getLogManager().readConfiguration( inputStream );

Upvotes: 0

Szdnez
Szdnez

Reputation: 69

I was able to solve my remote logging problems. I forgot to add a new Servlet which is called by remote logging to "transfer" the data from client to server, e.g.:

@WebServlet(
        name = "remoteLogging",
        // The url from the error message according missing ressources
        urlPatterns = "/VAADIN/widgetsets/myApplication.vaadin.widgetset.MyApplicationWidgetset/remote_logging"
)
public class GwtRemoteLoggingServlet
extends com.google.gwt.logging.server.RemoteLoggingServiceImpl
{}

I can't use debug console and that stuff because the problem only occurs in production environment . And I do not want to explain our customers how to use Firefox development tools...

Thanks for the hint regarding u2f. I will have a look but I don't think that's the problem, because it also occurs in Chrome etc. But still we are using a Vaadin version which is affected, so...

I'll report if I have any news.

Upvotes: 0

Dennis C
Dennis C

Reputation: 24747

If you update your module.gwt.xml, you must also update the GWT compiler classpath to include the JAR of class and source code files of the library being used.

Upvotes: 0

Related Questions