cancel
Showing results for 
Search instead for 
Did you mean: 

Solr log files (change location)

jlocke
Champ in-the-making
Champ in-the-making
Hi,

I have installed Alfresco Community 4.2 (/opt/alfresco).
Into this folder, I cand find some solr log files :

solr.log
solr.log.2012-12-29
solr.log.2012-12-30
solr.log.2012-12-31
solr.log.2013-01-01
solr.log.2013-01-02
solr.log.2013-01-03
solr.log.2013-01-04
solr.log.2013-01-05
solr.log.2013-01-06

I would like to move automaticaly those files to a specific folder. I've tried to change the log4j.appender.File.File propertie in tomcat/work/Catalina/localhost/solr/WEB-INF/classes/log4j.properties, but when I restart Alfresco, this file is reset/overwritten and my modification of the property is not saved.

Is there a way to change this permanently ?

Thank you.
7 REPLIES 7

andy
Champ on-the-rise
Champ on-the-rise
Hi

The over-ride for SOLR is currently fixed:

Add log4j-solr.properties

in <tomcat>/shared/classes
or somewhere else at the root of the classpath.

Andy

xarope
Champ in-the-making
Champ in-the-making
On my test platform with Alfresco 4.2.c CE, testing with a split solr and alfresco instance server setup (i.e. solr on a separate server from the alfresco instance), I've tried the following:
1) adding a log4j-solr.properties file in /opt/alfresco/tomcat/shared/classes on the alresco instance server; the file is owned by root
2) adding a log4j-sor.properties file /var/lib/tomcat7/shared/classes on the solr server; the file is owned by tomcat7

the file just contains:
log4j.appender.File.File=/tmp/solr.log

where tomcat7 can definitely write to /tmp

But after restarting alfresco 4.2.c on the alfresco server, and tomcat7 on the solr server, I get the error "java.io.FileNotFoundException: solr.log (Permission denied)" in the catalina.out file on the solr server.

I even tried to change the original log4j.properties file found in the alfresco server's /opt/alfresco/tomcat/work/Catalina/localhost/solr/WEB-INF/classes/ folder, but no joy.

*scratches head* what am I doing wrong here?

mstein
Champ in-the-making
Champ in-the-making
Currently investigating this issue. Did you find a solution?

ed008
Champ in-the-making
Champ in-the-making
It took me a while to work this one out as the documentation isn't clear.
for reference, my setup is OS X 10.9 with 4.2e

To get all the log files in the right place copy the
log4j.properties
files from the paths for AWE, Alfresco, Share and Solr.
The Solr file is under
/tomcat/work/Catalina/localhost/solr/
for me (and gets replaced every time Alfresco is started).

Place the copies in
/tomcat/shared/classes/alfresco/extension


Rename them
xxxx-log4j.properties
e.g.
solr-log4j.properties


Edit the file path  e.g.
log4j.appender.File.File=/<your_path>/tomcat/logs/solr.log


Restart Alfresco and you should see the log files appear in the location you specified.

Let me know if it doesn't work.
Ed

eswbitto
Confirmed Champ
Confirmed Champ
@ Ed008

I have tried your above instructions and I can't get the files to change locations. Do I need to do something with the original files by chance or just leave them alone.

What I did was take the 4 files for alfresco, share, awe, and Solr. Renamed them to
alfresco.log4j.properties….etc for each one.

Placed them in tomcat/shared/classes/alfresco/extension…

Restarted alfresco and I only have the alfresco.log file working. I've pointed the log location for all 4 files to go to /var/log/Alfresco/filename.log

Should there be something else that I should be doing?

CentOS 6.4 on alfresco 4.2.d

ed008
Champ in-the-making
Champ in-the-making
Just checking, are you filenames alfresco.log4j.properties with a '.' (period) or alfresco-log4j.properties with a '-' (dash)? The - worked for me.
i'm not sure if it's relevant but might be worth checking.

I didn't do anything to the original log4j.properties files and before I fixed this the log files would appear in the root drive or <tomcat>/logs/ depending on how alfresco was started. Using the full path in the custom-log4j.properties files has solved that issues.

Here's the contents of my solr-log4j.properties file if it helps and in this case the alfresco directory is in the root of the disk.

<blockcode>
# Set root logger level to error
log4j.rootLogger=WARN, Console, File

###### Console appender definition #######

# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout

log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n

###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=/Alfresco/tomcat/logs/solr.log   ##### this is the only line i changed ####
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{ABSOLUTE} %-5p [%c] %m%n
</blockcode>

For <strong>alfresco, share, etc</strong> if I modified the log4j.properties in their path the log file path changed I just put the custom log4j.properties files all in extensions to make future updates easier, it was only <strong>solr</strong> that was causing me trouble originally.

Let me know how you get on and I'll see what else I can find if it doesn't work for you.
Ed

pnkrravi
Champ in-the-making
Champ in-the-making
Hi,
I have done the same steps in Mac OSX. I see the empty log files created in tomcat/logs location. But in the root, we have the log files with daata. Just followed your step as given below.

1. Copy the log4j.properties files from respective location for all the appications (share, alfresco, awe, solr) to shared/classes/extention and renamed each file to respective application (share-log4j.properties)
2. updated the log file path (/Applications/alfresco-4.2.2/tomcat/logs/)
3. restart the alfresco

Please let me know if we need to remove the original files from the original location.

Regards,
Ravi Pandikunta