Foros de discusión

Log 4j is not working in my portlet

Joby KJ, modificado hace 11 años.

Log 4j is not working in my portlet

Junior Member Mensajes: 43 Fecha de incorporación: 13/07/12 Mensajes recientes
Dear All,
I have configured log4j in my portlet using xml file for file logging. But it is not working.


<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="file" class="org.apache.log4j.FileAppender">
<param name="Append" value="false"/>
<param name="File" value="D:/log/portal.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<logger name="com.test" additivity="false">
<level value="info"/>
<appender-ref ref="file"/>
</logger>
<root>
<level value="info"/>
<appender-ref ref="file"/>
</root>
</log4j:configuration>


Please advice.

Thanks
Joby
Siby Mathew, modificado hace 11 años.

RE: Log 4j is not working in my portlet

Expert Mensajes: 268 Fecha de incorporación: 4/03/11 Mensajes recientes
Hi Joby,
Did you place the above file in WEB-INF/src ?
Also I dont have the following in my configuration, do you need this line ?
<param name="Append" value="false">


Thanks,
Siby
Joby KJ, modificado hace 11 años.

RE: Log 4j is not working in my portlet

Junior Member Mensajes: 43 Fecha de incorporación: 13/07/12 Mensajes recientes
I have palce the log4j.xml in WEB-INF/src and commented line "<param name="Append" value="false"/> " . Still not working
Siby Mathew, modificado hace 11 años.

RE: Log 4j is not working in my portlet

Expert Mensajes: 268 Fecha de incorporación: 4/03/11 Mensajes recientes
Hi Joby,
Do you require the appender-ref here ? (Did you add it for the additivity property ?)
<logger name="com.test" additivity="false">
<level value="info" />
[b]<appender-ref ref="file" />[/b]
</logger>


Thanks,
Siby
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Log 4j is not working in my portlet

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Joby KJ:
I have configured log4j in my portlet using xml file for file logging. But it is not working.


Many times it won't.

Liferay configures log4j for you and will not use your log4j.xml regardless of where you put it. If you are using a standard Liferay MVC portlet project, you should be using the Liferay logging facilities to log, and not your own logging configuration.
Joby KJ, modificado hace 11 años.

RE: Log 4j is not working in my portlet

Junior Member Mensajes: 43 Fecha de incorporación: 13/07/12 Mensajes recientes
Hi David,
Please tell me the name and path of that file. I possible mention sample configuration also.


thanks
Joby