check log4j configuration for changes every 10s

patch by tjake; reviewed by jbellis for CASSANDRA-1525

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1052104 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2010-12-22 23:53:40 +00:00
parent 213b4291af
commit b17aefbcf5
5 changed files with 19 additions and 7 deletions

View File

@ -2,6 +2,7 @@ dev
* fix cli crash after backgrounding (CASSANDRA-1875)
* count timeouts in storageproxy latencies, and include latency
histograms in StorageProxyMBean (CASSANDRA-1893)
* check log4j configuration for changes every 10s (CASSANDRA-1525)
0.7.0-rc3

View File

@ -108,7 +108,7 @@ launch_service()
foreground=$2
props=$3
class=$4
cassandra_parms="-Dlog4j.configuration=log4j-server.properties"
cassandra_parms="-Dlog4j.configuration=log4j-server.properties -Dlog4j.defaultInitOverride=true"
if [ "x$pidpath" != "x" ]; then
cassandra_parms="$cassandra_parms -Dcassandra-pidfile=$pidpath"

View File

@ -37,7 +37,8 @@ set JAVA_OPTS=^
-Dcom.sun.management.jmxremote.port=8080^
-Dcom.sun.management.jmxremote.ssl=false^
-Dcom.sun.management.jmxremote.authenticate=false^
-Dlog4j.configuration=log4j-server.properties
-Dlog4j.configuration=log4j-server.properties^
-Dlog4j.defaultInitOverride=true
REM ***** CLASSPATH library setting *****

View File

@ -35,6 +35,7 @@ log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
log4j.appender.R.File=/var/log/cassandra/system.log
# Application logging options
#log4j.logger.com.facebook=DEBUG
#log4j.logger.com.facebook.infrastructure.gms=DEBUG
#log4j.logger.com.facebook.infrastructure.db=DEBUG
#log4j.logger.org.apache.cassandra=DEBUG
#log4j.logger.org.apache.cassandra.db=DEBUG
#log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG

View File

@ -42,6 +42,7 @@ import org.apache.cassandra.db.migration.Migration;
import org.apache.cassandra.utils.CLibrary;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.Mx4jTool;
import org.apache.log4j.PropertyConfigurator;
import org.mortbay.thread.ThreadPool;
/**
@ -53,8 +54,16 @@ import org.mortbay.thread.ThreadPool;
*/
public abstract class AbstractCassandraDaemon implements CassandraDaemon
{
private static Logger logger = LoggerFactory
.getLogger(AbstractCassandraDaemon.class);
//Initialize logging in such a way that it checks for config changes every 10 seconds.
static
{
String config = System.getProperty("log4j.configuration", "log4j-server.properties");
PropertyConfigurator.configureAndWatch(ClassLoader.getSystemResource(config).getFile(), 10000);
org.apache.log4j.Logger.getLogger(AbstractCassandraDaemon.class).info("Logging initialized");
}
private static Logger logger = LoggerFactory.getLogger(AbstractCassandraDaemon.class);
protected InetAddress listenAddr;
protected int listenPort;