dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37835
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19315: Log4j config init, aborting if system prop log4j.configuration is set
------------------------------------------------------------
revno: 19315
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-06-09 13:09:22 +0200
message:
Log4j config init, aborting if system prop log4j.configuration is set
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/log/Log4JLogConfigInitializer.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/log/Log4JLogConfigInitializer.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/log/Log4JLogConfigInitializer.java 2015-05-30 15:19:36 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/log/Log4JLogConfigInitializer.java 2015-06-09 11:09:22 +0000
@@ -28,10 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
import java.io.File;
import java.util.List;
-import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Level;
@@ -41,6 +42,8 @@
import org.hisp.dhis.external.location.LocationManager;
import org.springframework.beans.factory.annotation.Autowired;
+import com.google.common.collect.Lists;
+
/**
* @author Lars Helge Overland
*/
@@ -56,6 +59,7 @@
private static final String DATA_EXCHANGE_LOGGER_FILENAME = "dhis-data-exchange.log";
private static final String DATA_SYNC_LOGGER_FILENAME = "dhis-data-sync.log";
private static final String GENERAL_LOGGER_FILENAME = "dhis.log";
+ private static final String LOG4J_CONF_PROP = "log4j.configuration";
private static final Log log = LogFactory.getLog( Log4JLogConfigInitializer.class );
@@ -71,6 +75,12 @@
return;
}
+ if ( isNotBlank( System.getProperty( LOG4J_CONF_PROP ) ) )
+ {
+ log.info( "Aborting default log config, external config set through system prop " + LOG4J_CONF_PROP + ": " + System.getProperty( LOG4J_CONF_PROP ) );
+ return;
+ }
+
locationManager.buildDirectory( LOG_DIR );
configureLoggers( ANALYTICS_TABLE_LOGGER_FILENAME, Lists.newArrayList( "org.hisp.dhis.resourcetable", "org.hisp.dhis.analytics.table" ) );
@@ -81,7 +91,7 @@
configureRootLogger( GENERAL_LOGGER_FILENAME );
}
-
+
/**
* Configures rolling file loggers.
*