Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Balaji Chopparapu
Debugging velocity template
22. Oktober 2012 02:57
Antwort

Balaji Chopparapu

Rang: New Member

Nachrichten: 22

Eintrittsdatum: 8. Oktober 2010

Neue Beiträge

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
James Falkner
RE: Debugging velocity template
22. Oktober 2012 12:26
Antwort

James Falkner

Community Moderator

Rang: Liferay Legend

Nachrichten: 1406

Eintrittsdatum: 17. September 2010

Neue Beiträge

Balaji 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:

1#set ($logFactory = $portal.getClass().forName('com.liferay.portal.kernel.log.LogFactoryUtil'))
2#set ($log = $logFactory.getLog('mylog'))
3$log.error($msgCount)
4$log.error("Hi There")


If you find a better way, let me know!
Hitoshi Ozawa
RE: Debugging velocity template
22. Oktober 2012 14:49
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue Beiträge

I only know of Velocity Debugging Template and using logging.

http://wiki.apache.org/velocity/VelocityDebuggingTemplate
Siby Mathew
RE: Debugging velocity template
23. Oktober 2012 02:20
Antwort

Siby Mathew

Rang: Expert

Nachrichten: 268

Eintrittsdatum: 4. März 2011

Neue Beiträge

Really useful information....Thanks for the code ! emoticon
Balaji Chopparapu
RE: Debugging velocity template
30. Oktober 2012 08:40
Antwort

Balaji Chopparapu

Rang: New Member

Nachrichten: 22

Eintrittsdatum: 8. Oktober 2010

Neue Beiträge

Thanks James. This is really useful hint.
Michel Wicky
RE: Debugging velocity template
13. Januar 2013 08:09
Antwort

Michel Wicky

Rang: Regular Member

Nachrichten: 130

Eintrittsdatum: 2. Juli 2010

Neue Beiträge

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
Anhänge: VM_liferay.vm (5,6k)
Fernando Fernandez
RE: Debugging velocity template
9. August 2016 09:56
Antwort

Fernando Fernandez

Rang: Regular Member

Nachrichten: 143

Eintrittsdatum: 22. August 2007

Neue Beiträge

James Falkner:

1#set ($logFactory = $portal.getClass().forName('com.liferay.portal.kernel.log.LogFactoryUtil'))
2#set ($log = $logFactory.getLog('mylog'))
3$log.error($msgCount)
4$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

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!