Fórum

RE: Mojarra logging messagse going missing

J S, modificado 12 Anos atrás.

Mojarra logging messagse going missing

Junior Member Postagens: 31 Data de Entrada: 11/04/12 Postagens Recentes
Hi,

I'm finding that logging messages from the mojarra library aren't appearing in any of the tomcat or liferay log files. They did when the application was servlet based.

Mojarra uses Java SE Logging. I am currently finding that the PartialViewContextImpl class is catching an exception and logging it, but I never see the message. This is making tracking problems down quite hard!

I've tried making tomcat use log4j but this hasn't helped.

Is there an example of setting up logging in liferay with mojarra?

Thanks

John
thumbnail
Neil Griffin, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Are you using PortletFaces Bridge? Liferay Faces Bridge has a new class named ExceptionHandlerAjaxImpl that might help with the logging issue you mentioned. It should be registered automatically if you have the liferay-faces-bridge-impl JAR in your portlet's WEB-INF/lib folder.
J S, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Junior Member Postagens: 31 Data de Entrada: 11/04/12 Postagens Recentes
I'm using


<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>liferay-faces-bridge-impl</artifactId>
<version>3.0.0-BETA1</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>liferay-faces-alloy</artifactId>
<version>3.0.0-BETA1</version>
</dependency>


Log messages from my app come out ok, just the ones from the mojarra library. I can step over it in the debugger and see it go into the method, but somehow it's not coming out in the log file.

Thanks,

John
thumbnail
Neil Griffin, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
If you set a breakpoint in ExceptionHandlerAjaxImpl at line 62, does line 62 get reached?
if (throwable != null) {
	logger.error(throwable); // LINE 62
}
J S, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Junior Member Postagens: 31 Data de Entrada: 11/04/12 Postagens Recentes
No, because the exception is handled just by logging it, it doesn't get queued. It's this bit in PartialViewContextImpl.processPartial


            try {
                processComponents(viewRoot, phaseId, executeIds, ctx);
            } catch (Exception e) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.log(Level.INFO,
                           e.toString(),
                           e);
                }
            }


where logger is a java.util.logging.Logger

I'm sure it's just a configuration issue, but I can't work out what!

John
thumbnail
Neil Griffin, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
J S, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Junior Member Postagens: 31 Data de Entrada: 11/04/12 Postagens Recentes
It seems like you have to explicitly assign a handler in your webapp, the normal defaults don't seem to apply:

in WEB-INF/classes/logging.properties

javax.enterprise.resource.webcontainer.jsf.handlers = java.util.logging.ConsoleHandler
javax.enterprise.resource.webcontainer.jsf.level = DEBUG


Thanks for your help,

John
thumbnail
Neil Griffin, modificado 12 Anos atrás.

RE: Mojarra logging messagse going missing

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Thanks John -- that's terrific info! I'm going to add this to the demo portlets. See FACES-1187