Fórum

Liferay change log file location in portal-log4j.xml

sandeep g, modificado 7 Anos atrás.

Liferay change log file location in portal-log4j.xml

Junior Member Postagens: 29 Data de Entrada: 18/11/14 Postagens Recentes
I am trying to customize the log file name and location in cluster environment, so that each liferay instance creates it own log file.

I see this settings in portal-log4j.xml which tells the name and location of log file. My question is what is @spi.id@ property ?
<appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="@liferay.home@/logs/liferay@spi.id@.%d{yyyy-MM-dd}.log" />
</rollingPolicy>

<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}:%L] %m%n" />
</layout>
</appender>

Can I set @spi.id@ system property with the server name in a cluster, so that each server will have its own log file. Or it is meant for any purpose in liferay ?

Lets say for liferay instance 1, I set spi.id system property as server1 and for liferay instance 2, I set system property spi.id as server2, so that each instance will log to a file like liferayserver1.05-05-2016 and liferayserver2.05.05.2016.

Please suggest.
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Liferay change log file location in portal-log4j.xml

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Just create META-INF/portal-log4j-ext.xml files in each instance and set the different log files.
sandeep l, modificado 7 Anos atrás.

RE: Liferay change log file location in portal-log4j.xml

Junior Member Postagens: 29 Data de Entrada: 18/11/14 Postagens Recentes
I am working on JBoss EAP. I tried to place META-INF/portal-log4j-ext.xml in com.liferay.portal module directory , but for some reason liferay is not finding it. I even kept it in a seperate jar and placed in com.liferay.portal modules directory still no luck.

Any suggestion on how to do it in Jboss EAP.
thumbnail
Allen Ziegenfus, modificado 5 Anos atrás.

RE: Liferay change log file location in portal-log4j.xml

New Member Postagens: 11 Data de Entrada: 29/12/15 Postagens Recentes
Actually this spi.id solution seems pretty elegant to me, especially in a cloud environment. 

I'm not sure what this variable was intended for but setting CATALINA_OPTS to -Dspi.id=$HOSTNAME helps to create instance specific log files that can be then stored in a shared volume
thumbnail
Andrew Jardine, modificado 7 Anos atrás.

RE: Liferay change log file location in portal-log4j.xml

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Just to add some two cents around nomenclature. Refer to them as "servers" or "installations". the term INSTANCE means something very specific in Liferay as a single INSTALLATION of Liferay can manage multiple (Portal) Instances.