掲示板

Log 4j is not working in my portlet

11年前 に Joby KJ によって更新されました。

Log 4j is not working in my portlet

Junior Member 投稿: 43 参加年月日: 12/07/13 最新の投稿
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
11年前 に Siby Mathew によって更新されました。

RE: Log 4j is not working in my portlet

Expert 投稿: 268 参加年月日: 11/03/04 最新の投稿
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
11年前 に Joby KJ によって更新されました。

RE: Log 4j is not working in my portlet

Junior Member 投稿: 43 参加年月日: 12/07/13 最新の投稿
I have palce the log4j.xml in WEB-INF/src and commented line "<param name="Append" value="false"/> " . Still not working
11年前 に Siby Mathew によって更新されました。

RE: Log 4j is not working in my portlet

Expert 投稿: 268 参加年月日: 11/03/04 最新の投稿
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
11年前 に David H Nebinger によって更新されました。

RE: Log 4j is not working in my portlet

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
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.
11年前 に Joby KJ によって更新されました。

RE: Log 4j is not working in my portlet

Junior Member 投稿: 43 参加年月日: 12/07/13 最新の投稿
Hi David,
Please tell me the name and path of that file. I possible mention sample configuration also.


thanks
Joby