Search in sources :

Example 1 with ClassVarsZK

use of com.ms.silverking.cloud.dht.meta.ClassVarsZK in project SilverKing by Morgan-Stanley.

the class LogStreamConfig method configureLogStreams.

public static void configureLogStreams(SKGridConfiguration gc, String logFileName) throws IOException, KeeperException {
    MetaClient dhtMC;
    DHTConfiguration dhtConfig;
    ClassVarsZK classVarsZK;
    ClassVars defaultClassVars;
    PrintStream logStream;
    File logDir;
    dhtMC = new com.ms.silverking.cloud.dht.meta.MetaClient(gc);
    dhtConfig = dhtMC.getDHTConfiguration();
    classVarsZK = new ClassVarsZK(dhtMC);
    if (dhtConfig.getDefaultClassVars() != null) {
        defaultClassVars = DHTConstants.defaultDefaultClassVars.overrideWith(classVarsZK.getClassVars(dhtConfig.getDefaultClassVars()));
    } else {
        defaultClassVars = DHTConstants.defaultDefaultClassVars;
    }
    logDir = new File(DHTConstants.getSKInstanceLogDir(defaultClassVars, gc));
    Log.warning("Ensuring created: ", logDir);
    logDir.mkdirs();
    logStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(new File(logDir, logFileName))), true);
    System.setOut(logStream);
    System.setErr(logStream);
    Log.setPrintStreams(logStream);
}
Also used : ClassVarsZK(com.ms.silverking.cloud.dht.meta.ClassVarsZK) PrintStream(java.io.PrintStream) MetaClient(com.ms.silverking.cloud.dht.meta.MetaClient) MetaClient(com.ms.silverking.cloud.dht.meta.MetaClient) FileOutputStream(java.io.FileOutputStream) ClassVars(com.ms.silverking.cloud.dht.meta.ClassVars) DHTConfiguration(com.ms.silverking.cloud.dht.meta.DHTConfiguration) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream)

Aggregations

ClassVars (com.ms.silverking.cloud.dht.meta.ClassVars)1 ClassVarsZK (com.ms.silverking.cloud.dht.meta.ClassVarsZK)1 DHTConfiguration (com.ms.silverking.cloud.dht.meta.DHTConfiguration)1 MetaClient (com.ms.silverking.cloud.dht.meta.MetaClient)1 BufferedOutputStream (java.io.BufferedOutputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 PrintStream (java.io.PrintStream)1