in order to separate the hybris logs from console (catalina) wrapper (tanuki) and tomcat I created these two configs.
#local.properties
log4j.appender.FILE = org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File = ${HYBRIS_LOG_DIR}/tomcat/hybris.log
log4j.appender.FILE.Append = true
log4j.appender.FILE.DatePattern = '-'yyyy-MM-dd
log4j.appender.FILE.layout = org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern = %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%-5p|%X{RemoteAddr}|%X{TomcatSessionId}|%c] %m%n
log4j.rootLogger=INFO, FILE
This was put into the local.properties and creates logs in hybris.log And I also created this:
#log4j_init_tomcat.properties
log4j.appender.TOMCAT_FILE = org.apache.log4j.DailyRollingFileAppender
log4j.appender.TOMCAT_FILE.File = ${HYBRIS_LOG_DIR}/tomcat/tomcat.log
log4j.appender.TOMCAT_FILE.Append = true
log4j.appender.TOMCAT_FILE.DatePattern = '-'yyyy-MM-dd
log4j.appender.TOMCAT_FILE.layout = org.apache.log4j.PatternLayout
log4j.appender.TOMCAT_FILE.layout.ConversionPattern = %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%-5p|%X{RemoteAddr}|%X{TomcatSessionId}|%c] %m%n
log4j.rootLogger=INFO, TOMCAT_FILE
which is placed in the log4j_init_tomcat.properties which is load in the tanuki wrapper as
wrapper.java.additional.22=-Dlog4j.configuration=file:%CATALINA_BASE%/conf/log4j_init_tomcat.properties
Tomcat.log file is created but empty and I don't see any reason why.
This is an output from the console log file:
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Reading configuration from URL file:../conf/log4j_init_tomcat.properties
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Parsing for [root] with value=[INFO, TOMCAT_FILE].
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Level token is [INFO].
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Category root set to INFO
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Parsing appender named "TOMCAT_FILE".
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Parsing layout options for "TOMCAT_FILE".
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: Setting property [conversionPattern] to [%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%-5p|%X{RemoteAddr}|%X{TomcatSessionId}|%c] %m%n].
INFO | jvm 1 | main | 2015/09/16 22:36:32.711 | log4j: End of parsing for "TOMCAT_FILE".
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [datePattern] to ['-'yyyy-MM-dd].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [append] to [true].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [file] to [/opt/hybris/log/tomcat/tomcat.log].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: setFile called: /opt/hybris/log/tomcat/tomcat.log, true
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: setFile ended
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Appender [TOMCAT_FILE] to be rolled at midnight.
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Parsed "TOMCAT_FILE" options.
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Finished configuring.
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Parsing for [root] with value=[INFO, FILE].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Level token is [INFO].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Category root set to INFO
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Parsing appender named "FILE".
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Parsing layout options for "FILE".
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [conversionPattern] to [%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%-5p|%X{RemoteAddr}|%X{TomcatSessionId}|%c] %m%n].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: End of parsing for "FILE".
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [append] to [true].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [file] to [/opt/hybris/log/tomcat/hybris.log].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Setting property [datePattern] to ['-'yyyy-MM-dd].
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: setFile called: /opt/hybris/log/tomcat/hybris.log, true
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: setFile ended
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Appender [FILE] to be rolled at midnight.
INFO | jvm 1 | main | 2015/09/16 22:36:32.812 | log4j: Parsed "FILE" options.
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Parsing for [org.apache.cxf] with value=[WARN].
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Level token is [WARN].
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Category org.apache.cxf set to WARN
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Handling log4j.additivity.org.apache.cxf=[null]
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Parsing for [de.hybris.platform.print.comet.utils.StopWatch] with value=[ALL].
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Level token is [ALL].
INFO | jvm 1 | main | 2015/09/16 22:36:32.912 | log4j: Category de.hybris.platform.print.comet.utils.StopWatch set to ALL
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Handling log4j.additivity.de.hybris.platform.print.comet.utils.StopWatch=[null]
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Parsing for [print.soap.logging] with value=[ALL].
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Level token is [ALL].
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Category print.soap.logging set to ALL
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Handling log4j.additivity.print.soap.logging=[null]
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Parsing for [your.package] with value=[debug].
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Level token is [debug].
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Category your.package set to DEBUG
INFO | jvm 1 | main | 2015/09/16 22:36:32.913 | log4j: Handling log4j.additivity.your.package=[null]
I am doing all this for logstash so it can be logged properly. I hope someone can help me!
With kind regards, Fide
Can you try this ..
log4j.rootLogger=INFO,TOMCAT_FILE,FILE
log4j.logger.TOMCAT_FILE=INFO,TOMCAT_FILE
log4j.appender.TOMCAT_FILE.Threshold=INFO
log4j.additivity.com.baseframework=false
log4j.appender.TOMCAT_FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.TOMCAT_FILE.File=${HYBRIS_LOG_DIR}/tomcat/tomcat.log
log4j.appender.TOMCAT_FILE.Append=true
log4j.appender.TOMCAT_FILE.DatePattern = '-'yyyy-MM-dd
log4j.appender.TOMCAT_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.TOMCAT_FILE.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%-5p|%X{RemoteAddr}|%X{TomcatSessionId}|%c] %m%n