Lingyun Bao
Lingyun Bao

Reputation: 31

How to enable log4j for Usergrid

I deployed usergrid in tomcat, I see it is using slf4j binds to log4j, I tried to put log4j.properties in /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes$ , but still not seeing log file created? anyone could help?

Usergrid is here, github.com/apache/incubator-usergrid

I built it myself and put the ROOT.war in tomcat /var/lib/tomcat7/webapps/, trying to enable logs in usergrid, I see a lot of log.info in usergrid's code, then I put log4j.properties in /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes, but log file is not created

# Root logger option
log4j.rootLogger=INFO, file

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender

#Redirect to Tomcat logs folder
log4j.appender.file.File=${catalina.home}/logs/logging.log

log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p     %c{1}:%L - %m%n

Upvotes: 3

Views: 150

Answers (1)

snoopdave
snoopdave

Reputation: 306

I've been able to configure Log4j logging in Usergrid by adding the following to Tomcat's CATALINA_OPTS environment variable:

-Dlog4j.configuration=file:/${path}/log4j.properties

Where ${path} is the path to your Log4j properties file.

Upvotes: 0

Related Questions