David Newton wrote:Goodness. I don't know what you're doing with the config file, which is why I was asking what you were doing with the config file and why you needed it. Log4J will pick up configuration files on the classpath automatically.
Well, the config file specifies my rolling appenders etc and also the the log file. I thought, and maybe erroneously on my part, the proper way to do that was to use
PropertyConfigurator.configure("META-INF/log4j.properties");
Is that the wrong approach to setting up log4j?
I don't know if this helps or not but here's the log4j.properties file contents.
log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.File=logs/SolrIndex.log
log4j.appender.rollingFile.MaxFileSize=2MB
log4j.appender.rollingFile.MaxBackupIndex=2
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
log4j.appender.rollingFile.layout.conversionPattern=%p %d %c – %m%n
log4j.rootLogger = DEBUG, rollingFile
I mean, the file exists inside of my jar. I just really want to know how to pick it up from my jar as opposed to the file not only being in my jar, but then me having to hand move it to where the thing is going to be deployed and then specifying something like this:
PropertyConfigurator.configure("C:/workspace/solr-maven/src/main/resources/META-INF/log4j.properties")
to be able to pick up the log4j file.
Kevin.