Fórum

print logs with username and hostname

Hardik Sanghani, modificado 6 Anos atrás.

print logs with username and hostname

Junior Member Postagens: 40 Data de Entrada: 16/02/15 Postagens Recentes
Hello team,

I am using log4j for loggings. I need include username along with the host name in the log line.

The problem I am facing is related to scope as below:

 
@RenderMapping
 public ModelAndView handleRenderRequest(
       MDC.put("username", "xyz")
       log.info("hello sample ")
}



OUTPUT:
-----------xyz : hello sample


This is workfine for only handleRenderRequest() method.

That should work for entire portlet or portal either,

I created filter but its not working, Can anyone know proper configuration of this ?

Thank you
hardik sanghani
thumbnail
Andrew Jardine, modificado 6 Anos atrás.

RE: print logs with username and hostname

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Hardik,

Which version of the portal are you using? The filter feels like the proper approach to solving this -- when you say it "didn't work" can you explain? Maybe provide us the filter code/config that you created so we can see what you have done?