Sachin Singh
Sachin Singh

Reputation: 99

Which Log4j is using by alfresco?

In my alfresco project so many log4j.properties files are present.Some of log4j.proprties files are present in my custom module the path of those log4j.properties are

/modules/xyz_webscripts_extensions/target/xyz_webscripts_repo
/modules/xyz_webscripts_extensions/target/test-classes
/modules/xyz_webscripts_extensions/src/main/amp

can anyone tell me which log4j.properties file are being used by my webservices. And how it's being initialized for my webservices?

Upvotes: 0

Views: 302

Answers (2)

Younes Regaieg
Younes Regaieg

Reputation: 4156

Actually, there is a bit more to this subject than the information shared in the previous response/comments. Once you clean up your project mvn clean you will have have only two log4j files (depending the version of the SDK you might end up with more or less, I do not track that for each and every version)

The one in src/main/... is actually supposed to hold the default setup for your module, and would eventually be bundled within your amp (or jar). The one from src/test/... on the other hand, is actually not packaged with the project and only loaded when running test or running your project in the embedded tomcat from the SDK mvn clean install -Prun or mvn clean install -Pamp-to-war depending on the nature of your project.

The files under target, are actually generated files (either by merging the other two files, or they have been extracted from an OOTB alfresco war) and they are definitely not to be used, as they will get removed on the next call to maven clean goal.

Bottom line, I guess it is safe to put your log4j holding the defaults (intended for prod) into src/main/... and put the dev setup in src/test/...

Upvotes: 0

Vikash Patel
Vikash Patel

Reputation: 1348

As Muralidharan Deenathayalan said that in his comment.

And You can simply use log4j file under this folder /modules/xyz_webscripts_extensions/src/main/amp

Upvotes: 2

Related Questions