Foros de discusión
Debugging velocity template
Balaji Chopparapu, modificado hace 11 años.
Debugging velocity template
New Member Mensajes: 22 Fecha de incorporación: 8/10/10 Mensajes recientes
Hi,
How can I debug velocity template that is assigned to a structure and webcontent ? Till now I am printing all variables and doing debugging in a rude way. Can I use eclipse or any other IDE to debug velocity template?
Thanks in Advance,
Balaji
How can I debug velocity template that is assigned to a structure and webcontent ? Till now I am printing all variables and doing debugging in a rude way. Can I use eclipse or any other IDE to debug velocity template?
Thanks in Advance,
Balaji
James Falkner, modificado hace 11 años.
RE: Debugging velocity template
Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientesBalaji Chopparapu:
Hi,
How can I debug velocity template that is assigned to a structure and webcontent ? Till now I am printing all variables and doing debugging in a rude way. Can I use eclipse or any other IDE to debug velocity template?
Thanks in Advance,
Balaji
I do not know of any IDE that would let you, for example, set breakpoints in Velocity code and debug it - I've always used printing variables and such. One thing you may be interested in is how to emit debug information to the log file:
#set ($logFactory = $portal.getClass().forName('com.liferay.portal.kernel.log.LogFactoryUtil'))
#set ($log = $logFactory.getLog('mylog'))
$log.error($msgCount)
$log.error("Hi There")
If you find a better way, let me know!
Hitoshi Ozawa, modificado hace 11 años.
RE: Debugging velocity template
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
I only know of Velocity Debugging Template and using logging.
http://wiki.apache.org/velocity/VelocityDebuggingTemplate
http://wiki.apache.org/velocity/VelocityDebuggingTemplate
Siby Mathew, modificado hace 11 años.
RE: Debugging velocity template
Expert Mensajes: 268 Fecha de incorporación: 4/03/11 Mensajes recientes
Really useful information....Thanks for the code !
Michel Wicky, modificado hace 11 años.
RE: Debugging velocity template
Regular Member Mensajes: 130 Fecha de incorporación: 3/07/10 Mensajes recientes
Hello Hitoshi, i tested the velocity debugging but was not able to obtain any result. I was testing it using LR 6.1 EE and putted the macro into VM_liferay.vm in portal-impl.jar.
I used the script without $context.
Here is the vm script i would like to debug with #showDebugPopup macro call :
#set ($isOkinawaLogged = $request.get("remote-user"))
#if ($isOkinawaLogged != '')
#set ($userFullName = $user.getFullName())
<h1>Bonjour $userFullName</h1>
<p>Félicitations ! Vous participez à l'action bénévole des associations suivantes :'</p>
<li>
#foreach ($my_site_text IN $my_sites_text )
<ul>($my_site_text.getName())</ul>
#end
</li>
#else
<div class="portlet-msg-alert">
<h1>Bonjour cher visiteur, chère visiteuse</h1>
<p>Vous ne participez pas encore à l'action bénévole des associations affiliées au projet Okinawa. Nous nous réjouissons de vous accueillir très prochainement et vous compter bientôt parmi nous.</p>
<p>Vous trouverez ici la liste des associations auxquelles vous aurez adhérées.</p>
</div>
#end
#showDebugPopup()
Do you see something wrong ?
Note i'm able to debug a little bit with org.apache.velocity setted to debug, but it's not really sufficient.
Thank youz
I used the script without $context.
Here is the vm script i would like to debug with #showDebugPopup macro call :
#set ($isOkinawaLogged = $request.get("remote-user"))
#if ($isOkinawaLogged != '')
#set ($userFullName = $user.getFullName())
<h1>Bonjour $userFullName</h1>
<p>Félicitations ! Vous participez à l'action bénévole des associations suivantes :'</p>
<li>
#foreach ($my_site_text IN $my_sites_text )
<ul>($my_site_text.getName())</ul>
#end
</li>
#else
<div class="portlet-msg-alert">
<h1>Bonjour cher visiteur, chère visiteuse</h1>
<p>Vous ne participez pas encore à l'action bénévole des associations affiliées au projet Okinawa. Nous nous réjouissons de vous accueillir très prochainement et vous compter bientôt parmi nous.</p>
<p>Vous trouverez ici la liste des associations auxquelles vous aurez adhérées.</p>
</div>
#end
#showDebugPopup()
Do you see something wrong ?
Note i'm able to debug a little bit with org.apache.velocity setted to debug, but it's not really sufficient.
Thank youz
Archivos adjuntos:
Balaji Chopparapu, modificado hace 11 años.
RE: Debugging velocity template
New Member Mensajes: 22 Fecha de incorporación: 8/10/10 Mensajes recientes
Thanks James. This is really useful hint.
Fernando Fernandez, modificado hace 7 años.
RE: Debugging velocity template
Expert Mensajes: 396 Fecha de incorporación: 22/08/07 Mensajes recientesJames Falkner:
#set ($logFactory = $portal.getClass().forName('com.liferay.portal.kernel.log.LogFactoryUtil')) #set ($log = $logFactory.getLog('mylog')) $log.error($msgCount) $log.error("Hi There")
In 6.2 CE GA6 we get "Cannot retrieve method forName from object of class java.lang.Class due to security restrictions."
Any ideas?
Thanks
Fernando