|
|
|
@@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import org.apache.log4j.Logger; |
|
|
|
import org.apache.log4j.PropertyConfigurator; |
|
|
|
|
|
|
|
import altk.comm.engine.Broadcast.BroadcastState; |
|
|
|
import altk.comm.engine.exception.BroadcastError; |
|
|
|
@@ -66,7 +67,7 @@ public abstract class CommEngine extends HttpServlet |
|
|
|
*/ |
|
|
|
protected EngineResources resources; |
|
|
|
|
|
|
|
private static Logger myLogger = Logger.getLogger(CommEngine.class); |
|
|
|
private static Logger myLogger; |
|
|
|
|
|
|
|
private ScheduledExecutorService scheduler; |
|
|
|
|
|
|
|
@@ -97,13 +98,35 @@ public abstract class CommEngine extends HttpServlet |
|
|
|
*/ |
|
|
|
public final void init() |
|
|
|
{ |
|
|
|
myLogger.info("init() invoked"); |
|
|
|
// check init parameters |
|
|
|
ServletContext servletContext = getServletContext(); |
|
|
|
String propertiesFilePath; |
|
|
|
|
|
|
|
propertiesFilePath = servletContext.getInitParameter(getPropertiesContextName()); |
|
|
|
File propertiesFile = new File(propertiesFilePath); |
|
|
|
|
|
|
|
// Configure log4j using log4j.properties file, \ |
|
|
|
// sibling to the engine properties file. |
|
|
|
// This change is backward compatible with placing the log4j.properties file in |
|
|
|
// the class path. |
|
|
|
String log4j_properties = propertiesFile.getParent() + "/log4j.properties"; |
|
|
|
try |
|
|
|
{ |
|
|
|
PropertyConfigurator.configure(log4j_properties); |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
// Do nothing, assuming the exception is FileNotFoundException. |
|
|
|
// Remaining log4j initialization will look for log4j.properties |
|
|
|
// file in the class path. |
|
|
|
} |
|
|
|
// This activates Logger class instantiation. At this point, if lo4j |
|
|
|
// is not yet configured, |
|
|
|
// it will look for the log4j.properties file in the class path. |
|
|
|
myLogger = Logger.getLogger(CommEngine.class); |
|
|
|
|
|
|
|
myLogger.info("init() invoked"); |
|
|
|
CommonLogger.startup.info("Using lo4j properites file " + log4j_properties); |
|
|
|
CommonLogger.startup.info("Using configuration file " + propertiesFile.getAbsolutePath()); |
|
|
|
config = new Properties(); |
|
|
|
try |
|
|
|
|