I need to use log4j in a js function in a jsp that can be binded to a button click.

something like this:

   <script> 
function logg(){ 
 <%log.info(variables + "text" + timestamp + request.getRemoteAddr())%>
}

This function will be called onclick in a button. Unfortunately, I can't do it in a servlet. I tried looking up for a ajax call but i don't know how to do it.

How can I do it without log4j logging every time that I call the jsp but only when I click that button?

Thanks

0 Answers