Indice

File log4j.properties

Il file log4j.properties, è utilizzato per configurare le modalità di logging in geoweb.

Si possono specificare, tra l'altro, Logging Level selettivamente e su quali file verranno salvati i log. Per una guida completa fare riferimento a quella ufficiale qui.

Logging Level

Impostando un logging level, si avrà come effetto quello di visualizzare loggati solo i messaggi di pari livello o superiore. Ecco la lista dei logging level, in ordine crescente dal meno al più restrittivo:

Altri:

Per quanto riguarda in Geoweb, è buona prassi impostare il logging level a DEBUG in fase di sviluppo/dispiegamento in ambiente di test/collaudo, ed ad WARN od ERROR in produzione.

Log generati da librerie di terze parti, come Activti e MongoDB vengono in genere tenuti sempre con logging level più restrittivi, come ERROR, a meno di specifiche necessità di debugging.

I log relativi al GwMailService sono in genere configurati per essere loggati su un file separato.

Template log4j.properties (Webclient)

log4j.properties
# Set root logger level to DEBUG and its appenders to A1 and file
# A1 and file are arbitrary alias names for specific appender, configured below
log4j.rootLogger=DEBUG, A1, file
 
log4j.logger.com.geowebframework=DEBUG, A1, file
 
#Avoid multiple log rows
log4j.additivity.com.geowebframework=false
 
#Mitigates Activiti logs applying ERROR log level
log4j.logger.org.activiti=ERROR, A1
 
#Mitigates MongoDB logs applying ERROR log level
log4j.logger.org.mongodb.driver.cluster=ERROR, A1
 
#Mitigates GW Security logs applying INFO log level
log4j.logger.com.geowebframework.webclient.security.LogFileLogger=INFO,access
 
 
######################################################################
#	A1 is set to be a ConsoleAppender
######################################################################
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 
 
######################################################################
#	file is set to be a RollingFileAppender
######################################################################
log4j.appender.file=org.apache.log4j.RollingFileAppender  
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.File=${catalina.home}/logs/geoweb_client.log
log4j.appender.file.append=true
log4j.appender.file.MaxFileSize=10000KB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 
 
######################################################################
#	GwMailService
#
#	 add this section to logs on a separated custom file
######################################################################
log4j.logger.com.geowebframework.calendar.service.GwMailService=DEBUG, A1, gwMailServiceAppender
 
log4j.appender.gwMailServiceAppender=org.apache.log4j.RollingFileAppender
log4j.appender.gwMailServiceAppender.File=${catalina.home}/logs/gwMail.log
log4j.appender.gwMailServiceAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.gwMailServiceAppender.append=true
log4j.appender.gwMailServiceAppender.MaxFileSize=10000KB
log4j.appender.gwMailServiceAppender.MaxBackupIndex=10
log4j.appender.gwMailServiceAppender.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 
log4j.additivity.com.geowebframework.calendar.service.GwMailService=false

Template log4j.properties (Webadmin)

log4j.properties
# Set root logger level to DEBUG and its appenders to A1 and file
# A1 and file are arbitrary alias names for specific appender, configured below
log4j.rootLogger=DEBUG, A1, file
 
log4j.logger.com.geowebframework=DEBUG, A1, file
 
#Avoid multiple log rows
log4j.additivity.com.geowebframework=false
 
#Mitigates Activiti logs applying ERROR log level
log4j.logger.org.activiti=ERROR, A1
 
 
######################################################################
#	A1 is set to be a ConsoleAppender
######################################################################
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 
 
######################################################################
#	file is set to be a RollingFileAppender
######################################################################
log4j.appender.file=org.apache.log4j.RollingFileAppender  
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.File=${catalina.home}/logs/geoweb_admin.log
log4j.appender.file.append=true
log4j.appender.file.MaxFileSize=10000KB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout.ConversionPattern=%d [%t] %-5p %c - %m%n