Example usage for java.util Properties store

List of usage examples for java.util Properties store

Introduction

In this page you can find the example usage for java.util Properties store.

Prototype

public void store(OutputStream out, String comments) throws IOException 

Source Link

Document

Writes this property list (key and element pairs) in this Properties table to the output stream in a format suitable for loading into a Properties table using the #load(InputStream) load(InputStream) method.

Usage

From source file:net.minecraftforge.fml.common.Loader.java

public void runtimeDisableMod(String modId) {
    ModContainer mc = namedMods.get(modId);
    Disableable disableable = mc.canBeDisabled();
    if (disableable == Disableable.NEVER) {
        FMLLog.info("Cannot disable mod %s - it is never allowed to be disabled", modId);
        return;/*from  ww  w. j  a va2s  .  co m*/
    }
    if (disableable == Disableable.DEPENDENCIES) {
        FMLLog.info("Cannot disable mod %s - there are dependent mods that require its presence", modId);
        return;
    }
    if (disableable == Disableable.YES) {
        FMLLog.info("Runtime disabling mod %s", modId);
        modController.disableMod(mc);
        List<ModContainer> localmods = Lists.newArrayList(mods);
        localmods.remove(mc);
        mods = ImmutableList.copyOf(localmods);
    }

    try {
        Properties props = new Properties();
        props.load(new FileReader(forcedModFile));
        props.put(modId, "false");
        props.store(new FileWriter(forcedModFile), null);
    } catch (Exception e) {
        FMLLog.log(Level.INFO, e,
                "An error occurred writing the fml mod states file, your disabled change won't persist");
    }
}

From source file:com.intel.mtwilson.MyConfiguration.java

/**
 * Writes the key-value pair to mtwilson.properties
 *//*w w w .  j  a v a  2 s.  co  m*/
public void update(String key, String value) throws FileNotFoundException, IOException {
    List<File> files = listConfigurationFiles(); // in priority order - first one found for which we have write access will be updated
    for (File file : files) {
        log.debug("Looking at file: {}", file.getAbsolutePath());
        if (file.exists() && file.canRead() && file.canWrite()) {
            log.debug("Writable, checking encryption");
            // first check if the file is encrypted... if it is, we need to decrypt it before loading!
            try (FileInputStream in = new FileInputStream(file)) {
                String content = IOUtils.toString(in);

                if (Pem.isPem(content)) { // starts with something like -----BEGIN ENCRYPTED DATA----- and ends with -----END ENCRYPTED DATA-----
                    // a pem-format file indicates it's encrypted... we could check for "ENCRYPTED DATA" in the header and footer too.
                    String password = getApplicationConfigurationPassword();
                    if (password == null) {
                        log.warn(
                                "Found encrypted configuration file, but no password was found in system properties or environment");
                    }
                    if (password != null) {
                        ExistingFileResource resource = new ExistingFileResource(file);
                        PasswordEncryptedFile encryptedFile = new PasswordEncryptedFile(resource, password);
                        String decryptedContent = encryptedFile.loadString();
                        Properties p = new Properties();
                        p.load(new StringReader(decryptedContent));

                        p.setProperty(key, value);

                        StringWriter writer = new StringWriter();
                        p.store(writer, String.format("Changed: %s", key));
                        //                            log.debug("Updated: {} = {}", key, value);
                        encryptedFile.saveString(writer.toString());
                        break;
                    }
                } else {
                    log.debug("Writing plaintext properties to {}", file.getAbsolutePath());
                    Properties p = new Properties();
                    p.load(new StringReader(content));

                    p.setProperty(key, value);

                    try (FileOutputStream out = new FileOutputStream(file)) {
                        p.store(out, String.format("Changed: %s", key));
                    }
                    break;
                }
            }
        }
    }
}

From source file:de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordPosTaggerTrainer.java

@Override
public void collectionProcessComplete() throws AnalysisEngineProcessException {
    if (out != null) {
        IOUtils.closeQuietly(out);/*  w  w  w .  j  a  v a 2  s  . c om*/
    }

    // Load user-provided configuration
    Properties props = new Properties();
    try (InputStream is = new FileInputStream(parameterFile)) {
        props.load(is);
    } catch (IOException e) {
        throw new AnalysisEngineProcessException(e);
    }

    // Add/replace training file information
    props.setProperty("trainFile", "format=TSV,wordColumn=0,tagColumn=1," + tempData.getAbsolutePath());
    props.setProperty("model", targetLocation.getAbsolutePath());
    props.setProperty("encoding", "UTF-8");
    if (clusterFile != null) {
        String arch = props.getProperty("arch");
        arch = arch.replaceAll("\\$\\{distsimCluster\\}", clusterFile.getAbsolutePath());
        props.setProperty("arch", arch);
    }

    File tempConfig = null;
    try {
        // Write to a temporary location
        tempConfig = File.createTempFile("dkpro-stanford-pos-trainer", ".props");
        try (OutputStream os = new FileOutputStream(tempConfig)) {
            props.store(os, null);
        }

        // Train
        MaxentTagger.main(new String[] { "-props", tempConfig.getAbsolutePath() });
    } catch (Exception e) {
        throw new AnalysisEngineProcessException(e);
    } finally {
        // Clean up temporary parameter file
        if (tempConfig != null) {
            tempConfig.delete();
        }
    }
}

From source file:com.neophob.sematrix.properties.ApplicationConfigurationHelper.java

/**
 * Save presents.//from w w  w  .  j  a  va2  s  .c o m
 */
public void savePresents() {
    Properties props = new Properties();
    List<PresentSettings> presents = Collector.getInstance().getPresent();
    int idx = 0;
    for (PresentSettings p : presents) {
        props.setProperty("" + idx, p.getSettingsAsString());
        idx++;
    }

    try {
        OutputStream output = Collector.getInstance().getPapplet().createOutput(PRESENTS_FILENAME);
        props.store(output, "Visual Daemon presents file");
        LOG.log(Level.INFO, "Presents saved as {0}", PRESENTS_FILENAME);
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Failed to save {0}, Error: {1}", new Object[] { PRESENTS_FILENAME, e });
    }
}

From source file:com.android.sdklib.internal.repository.ArchiveInstaller.java

/**
 * Generates a source.properties in the destination folder that contains all the infos
 * relevant to this archive, this package and the source so that we can reload them
 * locally later.//from w  w  w  .j a va 2 s  . c  om
 */
private boolean generateSourceProperties(Archive archive, File unzipDestFolder) {
    Properties props = new Properties();

    archive.saveProperties(props);

    Package pkg = archive.getParentPackage();
    if (pkg != null) {
        pkg.saveProperties(props);
    }

    FileOutputStream fos = null;
    try {
        File f = new File(unzipDestFolder, SdkConstants.FN_SOURCE_PROP);

        fos = new FileOutputStream(f);

        props.store(fos, "## Android Tool: Source of this archive."); //$NON-NLS-1$

        return true;
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (fos != null) {
            try {
                fos.close();
            } catch (IOException e) {
            }
        }
    }

    return false;
}

From source file:com.symbian.driver.remoting.packaging.build.PackageBuilder.java

/**
 * Builds a Test Pacakge./*from   w w  w . java  2 s .c om*/
 * 
 * @see com.symbian.driver.remoting.packaging.build.Builder#Build(java.lang.String)
 * @param aTestPackage
 *            String : a test package path name.
 */
public void Build(File aTestPackage) {
    // get TestDriver properties
    String lReposRoot = null;
    String lXmlRoot = null;
    String lEpocRoot = null;
    File xmlZip = new File("Xml.zip");
    File reposZip = new File("Repository.zip");
    File depZip = new File("Dependencies.zip");
    File manifest = new File("Manifest.mf");
    File StatZip = new File("Stat.zip");

    String lPlatform = null; // winscw
    String lBuild = null; // urel
    String lSuiteFragment = null; // full URI
    boolean lPlatsec = false;
    boolean lTestexec = false;
    String lKernel = null;
    String lBuildNumber = null;
    URI lSuite = null;
    List<URI> lUriList = null;

    try {
        TDConfig CONFIG = TDConfig.getInstance();
        lEpocRoot = CONFIG.getPreferenceFile(TDConfig.EPOC_ROOT).getCanonicalPath(); // m:
        lReposRoot = CONFIG.getPreferenceFile(TDConfig.REPOSITORY_ROOT).getCanonicalPath(); // d:/td2_testing/repository
        File lXmlR = CONFIG.getPreferenceFile(TDConfig.XML_ROOT);
        lXmlRoot = lXmlR.getCanonicalPath(); // m:/epoc32/TestDriver/Plattest

        lPlatform = CONFIG.getPreference(TDConfig.PLATFORM);
        lBuild = CONFIG.getPreference(TDConfig.VARIANT);
        //lPlatsec = CONFIG.isPreference(TDConfig.PLATSEC);
        lPlatsec = !CONFIG.isPreference(TDConfig.SYS_BIN);
        lTestexec = CONFIG.isPreference(TDConfig.TEST_EXECUTE);
        lKernel = CONFIG.getPreference(TDConfig.KERNEL);
        lBuildNumber = CONFIG.getPreference(TDConfig.BUILD_NUMBER);
        lSuite = CONFIG.getPreferenceURI(TDConfig.ENTRY_POINT_ADDRESS);
        lSuiteFragment = lSuite.fragment();
        // build the .driver path

        if (lSuite.fileExtension() == null) {
            // CASE: no .driver

            String lRoot = lSuite.toString();

            int lLast = (lRoot.indexOf('.') > 0) ? lRoot.indexOf('.') : lRoot.length();

            File lRootDriver = new File(lXmlR, lRoot.substring(1, lLast).concat(".driver"));

            if (lRootDriver.isFile()) {
                lSuite = URI.createFileURI(lRootDriver.getCanonicalPath());
                // the fragment is correct because x.driver exists
            } else {
                // x.driver does not exist
                File[] lDriverFiles = lXmlR.listFiles(new FileFilter() {
                    public boolean accept(File lFile) {
                        if (lFile.getName().endsWith(".driver")) {
                            return true;
                        }
                        return false;
                    }
                });

                if (lDriverFiles.length == 1) {
                    // run the one
                    lSuite = URI.createFileURI(lDriverFiles[0].getCanonicalPath());
                    lSuiteFragment = lDriverFiles[0].getName().replaceAll("\\.driver", "") + "."
                            + lSuiteFragment;

                } else {
                    // more complain + return
                    LOGGER.log(Level.SEVERE,
                            "There are either no or more than one .driver files in : " + lXmlR.toString());
                    return;
                }
            }
        } else {
            lSuite = URI.createFileURI(lSuite.devicePath());
        }

    } catch (IOException lIOException) {
        LOGGER.log(Level.SEVERE, "Could not get values from config", lIOException);
        return;
    } catch (ParseException e) {
        LOGGER.log(Level.SEVERE, "Could not get values from config", e);
        return;
    }

    if (lBuildNumber == null) {
        LOGGER.log(Level.SEVERE, "Could not get the build number.");
        return;
    }
    if (lKernel == null) {
        LOGGER.log(Level.SEVERE, "Kernel is not available in the configuration.");
        return;
    }

    if (lSuiteFragment == null) {
        LOGGER.log(Level.SEVERE, "A Suite/test must be provided.");
        return;
    }

    try {
        // get all refrences.
        Task lTask = ResourceLoader.load(lSuite);

        lUriList = new ArrayList<URI>();

        for (Iterator lIterator = lTask.eAllContents(); lIterator.hasNext();) {
            Task lReferenceTask = (Task) new DriverSwitch().doSwitch((EObject) lIterator.next());
            if (lReferenceTask != null) {
                lUriList.add(lReferenceTask.eResource().getURI());
            }
        }

    } catch (IOException lIOException) {
        LOGGER.log(Level.SEVERE, "Could not get all refrences from " + lSuite.toFileString(), lIOException);
        return;
    }

    // where to pick the repository from
    File lRepos = new File((lReposRoot + File.separator + lBuildNumber + File.separator + lPlatform
            + File.separator + lBuild + File.separator + lSuiteFragment.replace('.', File.separatorChar))
                    .replaceAll("\\\\+", "\\\\"));
    if (!lRepos.isDirectory()) {
        LOGGER.log(Level.SEVERE, "Repository root " + lRepos.toString() + " does not exist.");
        return;
    }

    // where to pick the dependencies from
    String lDep = (lEpocRoot + File.separator + EPOC32 + File.separator + "release" + File.separator + lPlatform
            + File.separator + lBuild + File.separator).replaceAll("\\\\+", "\\\\");
    if (!new File(lDep).isDirectory()) {
        LOGGER.log(Level.SEVERE, "Epoc tree " + lDep + " does not exist.");
        return;
    }

    File lXml = new File(lSuite.toFileString());
    if (!lXml.exists()) {
        LOGGER.log(Level.SEVERE, "XML file " + lXml.toString() + " does not exist");
        return;
    }
    Zipper lZip = new Zipper();
    // Add The main xml file.
    lZip.addFile(lXml);
    // Add files referenced made by the main file.
    for (URI lItem : lUriList) {

        // get path part only path like ${variable}\... are allowed
        String lItemPathString = lItem.path();
        // remove \/ from beginning
        lItemPathString = lItemPathString.replaceFirst("^[\\/]+", "");
        if (lItemPathString.startsWith("\\$\\{\\w+\\}")) {
            LOGGER.log(Level.SEVERE, "Reference : " + lItem.toFileString() + " is not allowed.");
            return;
        }
        // do the substitution of variables

        String lRealFilePath = ModelUtils.subsituteVariables(lItemPathString);
        File lRealFile = new File(lRealFilePath);
        if (!lRealFile.isFile()) {
            LOGGER.log(Level.WARNING, "XML file " + lItem.toFileString() + " does not exist");
        } else {
            lZip.addFile(lRealFile, lItemPathString);
        }
    }

    // Zip the xml file

    lZip.zip(xmlZip, lXmlRoot);
    lZip.clear();

    // Zip the repository
    // pick the files from lRepos downward through the fragment
    File lStart = new File(
            (lReposRoot + File.separator + lBuildNumber + File.separator + lPlatform + File.separator + lBuild)
                    .replaceAll("\\\\+", "\\\\"));
    String[] lFragmentBits = lSuiteFragment.split("\\.");
    File[] lFiles = null;
    for (int i = 0; i < lFragmentBits.length; i++) {
        lStart = new File(lStart, lFragmentBits[i]);
        if (i == lFragmentBits.length - 1) {
            lFiles = listFilesAsArray(lStart, null, true); // the whole
            // tree
        } else {
            lFiles = listFilesAsArray(lStart, null, false); // just files
        }
        for (int j = 0; j < lFiles.length; j++) {
            if (lFiles[j].isFile()) {
                if (lPlatsec) {
                    if (lFiles[j].getName().toLowerCase().endsWith(".pkg")
                            || lFiles[j].getName().toLowerCase().endsWith(".sis")) {
                        lZip.addFile(lFiles[j]);
                    }
                } else {
                    if (!lFiles[j].getName().toLowerCase().endsWith(".sis")
                            && !lFiles[j].getName().toLowerCase().endsWith(".pkg")) {
                        lZip.addFile(lFiles[j]);
                    }
                }
            }
        }
    }
    lZip.zip(reposZip, lReposRoot);
    lZip.clear();

    // Zip dependencies
    final String lEpoc32DataZSystemData = (lEpocRoot + File.separator
            + com.symbian.driver.core.environment.ILiterals.EPOC32 + File.separator
            + com.symbian.driver.core.environment.ILiterals.DATA + File.separator + "z" + File.separator
            + com.symbian.driver.core.environment.ILiterals.SYSTEM + File.separator
            + com.symbian.driver.core.environment.ILiterals.DATA + File.separator).replaceAll("\\\\+", "\\\\");

    // add testexecute dependencies.
    if (!Epoc.isTargetEmulator(lPlatform)) {
        String[] tefFiles = null;
        Map<String, String> tefOptFiles = null;
        final String lEpoc32Tools = EPOC32 + File.separator + "tools" + File.separator;

        if (lTestexec) {
            try {
                String[] lTefFiles = TDConfig.getInstance().getTEFDependencies();
                //add optional files into the array
                //<file,condition> pair in lTefOptFiles, get set of keys/files
                tefOptFiles = TDConfig.getInstance().getTEFOptionalDependencies();
                Set<String> lTefOptFilesSet = tefOptFiles.keySet();
                String[] lTefOptFiles = lTefOptFilesSet.toArray(new String[tefOptFiles.size()]);

                tefFiles = new String[lTefFiles.length + lTefOptFiles.length];
                System.arraycopy(lTefFiles, 0, tefFiles, 0, lTefFiles.length);
                System.arraycopy(lTefOptFiles, 0, tefFiles, lTefFiles.length, lTefOptFiles.length);
            } catch (ParseException lParseException) {
                LOGGER.log(Level.SEVERE, lParseException.getMessage(), lParseException);
            }
            for (int i = 0; i < tefFiles.length; i++) {
                if (tefFiles[i].endsWith(".ini")) {
                    lZip.addFile(new File(lEpoc32DataZSystemData, tefFiles[i]));
                } else {
                    File lFile = new File(lDep, tefFiles[i]);
                    if (lFile.exists()) {
                        lZip.addFile(lFile);
                    } else {
                        LOGGER.warning("File does not exist : " + lFile);
                    }
                }
            }
        }
        if (lPlatsec && Epoc.is9x(lBuildNumber)) {
            lZip.addFile(new File(lEpocRoot, lEpoc32Tools + "makesis.exe"));
            lZip.addFile(new File(lEpocRoot, lEpoc32Tools + "signsis.exe"));
        }

        lZip.addFile(new File(lEpocRoot, EPOC32 + File.separator + "data" + File.separator + "buildinfo.txt"));

        LOGGER.fine("Generating " + depZip.getName());

        lZip.zip(depZip, lEpocRoot);
        lZip.clear();

        // add stat.dll, symbianUsb.dll, buildinfo.txt, stat.ini,
        // makesis.exe and signsis.exe:
        // the following files should be installed with TD2
        lZip.addFile(new File(lEpoc32DataZSystemData, "stat.ini"));
        lZip.addFile(new File(lEpocRoot, lEpoc32Tools + "stat" + File.separator + "stat.dll"));
        if (Epoc.is92plus(lBuildNumber)) {
            lZip.addFile(new File(lEpocRoot, lEpoc32Tools + "stat" + File.separator + "SymbianUsb.dll"));
        }
        LOGGER.fine("Generating " + StatZip.getName());
        lZip.zip(StatZip, lEpocRoot);
        lZip.clear();

    }

    // generate manifest file:

    Properties pr = new Properties();

    String header = "TestDriver Package file v2.0";

    pr.setProperty("suite", lSuiteFragment);
    pr.setProperty("xmldriver", lXml.getName());
    pr.setProperty("platform", lPlatform);
    pr.setProperty("build", lBuild);
    pr.setProperty("buildNumber", lBuildNumber);
    pr.setProperty("kernel", lKernel);

    try {
        FileOutputStream mf = new FileOutputStream(manifest);
        pr.store(mf, header);
        mf.close();
    } catch (IOException lE) {
        LOGGER.log(Level.SEVERE, "Error while generating manifest", lE);
    }

    // zip everything together

    if (xmlZip.exists()) {
        lZip.addFile(xmlZip);
    }
    if (reposZip.exists()) {
        lZip.addFile(reposZip);
    }
    if (depZip.exists()) {
        lZip.addFile(depZip);
    }
    if (manifest.exists()) {
        lZip.addFile(manifest);
    }
    if (StatZip.exists()) {
        lZip.addFile(StatZip);
    }

    File f = null;

    if (aTestPackage == null) {
        // No test package name defined before (first run)

        String lSuiteEnd = lSuiteFragment;
        if (lSuiteFragment.indexOf(".") != -1) {
            String[] lPaths = lSuiteFragment.split("\\.");
            lSuiteEnd = lPaths[lPaths.length - 1];
        }

        f = new File((lReposRoot + File.separator + lSuiteEnd + ".tpkg").replaceAll("\\\\+", "\\\\"));

    } else {
        f = aTestPackage;
    }

    lZip.zip(f, "");

    if (f.exists()) {
        LOGGER.info("Generated test package file v2.0: " + f.getAbsolutePath());
    } else {
        LOGGER.severe("Error generating test package file v2.0: " + f.getName());
    }

    if (!xmlZip.delete() || !reposZip.delete() || !manifest.delete() || !depZip.delete() || !StatZip.delete()) {
        LOGGER.fine("Could not delete Zip files");
    }
}

From source file:ca.weblite.codename1.ios.CodenameOneIOSBuildTask.java

/**
 * Fixes the properties in the Netbeans skeleton project that was set up by xmlvm.
 *///from   w ww  .j a  v a2s  . co  m
@Override
protected void fixSkeletonProperties() throws IOException {
    super.fixSkeletonProperties(); //To change body of generated methods, choose Tools | Templates.
    Properties p = new Properties();
    p.load(new FileInputStream(this.getSkeletonPropertiesFile()));
    String lib = p.getProperty("xmlvm.lib");
    if (lib == null) {
        lib = "";
    }
    if (lib.length() > 0) {
        lib += ",libzbar.a";
    } else {
        lib = "libzbar.a";
    }
    p.setProperty("xmlvm.lib", lib);
    p.store(new FileOutputStream(this.getSkeletonPropertiesFile()), "Updated xmlvm.lib");
}

From source file:com.edgenius.wiki.installation.UpgradeServiceImpl.java

@SuppressWarnings("unused")
private void up1550To1551() throws Exception {
    log.info("Version 1.55 to 1.551 is upgarding");

    //add server.db.schema 
    String root = DataRoot.getDataRoot();
    if (FileUtil.exist(root + Server.FILE)) {
        Server server = new Server();
        Properties prop = FileUtil.loadProperties(root + Server.FILE);
        server.syncFrom(prop);/*from   www .  j  a v  a2  s  . c  om*/
        server.setDbSchema("");
        server.syncTo(prop);
        prop.store(FileUtil.getFileOutputStream(root + Server.FILE), "save by server");

    }
}

From source file:com.streamsets.datacollector.cluster.TestShellClusterProvider.java

@Test
public void testRemovingProperties() throws Exception {
    Properties sdcProperties = new Properties();
    sdcProperties.put("stay", "Don't try to touch me!");
    sdcProperties.put("remove.me", "Yes please!");
    sdcProperties.put("remove.me.too", "Yes please!");
    sdcProperties.put(RuntimeInfo.DATA_COLLECTOR_BASE_HTTP_URL, "Yes please!");
    sdcProperties.put("http.bindHost", "Yes please!");
    sdcProperties.put("cluster.slave.configs.remove", "remove.me,remove.me.too");
    File etcDir = tempFolder.newFolder();

    File sdcPropertiesFile = new File(etcDir, "sdc.properties");
    try (OutputStream out = new FileOutputStream(sdcPropertiesFile)) {
        sdcProperties.store(out, null);
    }//from ww w .  j a v  a 2 s.c o m

    sparkProvider.rewriteProperties(sdcPropertiesFile, new ArrayList<>(), etcDir, Collections.emptyMap(),
            Collections.emptyMap(), "", Optional.empty());

    try (InputStream in = new FileInputStream(sdcPropertiesFile)) {
        Properties updatedProperties = new Properties();
        updatedProperties.load(in);

        Assert.assertEquals("Don't try to touch me!", updatedProperties.getProperty("stay"));
        Assert.assertFalse(updatedProperties.containsValue("remove.me"));
        Assert.assertFalse(updatedProperties.containsValue("remove.me.too"));
        Assert.assertFalse(updatedProperties.containsValue("http.bindHost"));
        Assert.assertFalse(updatedProperties.containsValue(RuntimeInfo.DATA_COLLECTOR_BASE_HTTP_URL));
    }
}

From source file:com.itemanalysis.jmetrik.gui.JmetrikPreferencesManager.java

public void loadLog() {
    String logHome = p.get(LOG_HOME, DEFAULT_LOG_HOME);
    String header = "#DO NOT EDIT - JMETRIK LOG PROPERTIES FILE - DO NOT EDIT";
    String fullPropertiesName = (logHome + "/" + DEFAULT_LOG_PROPERTY_FILE);
    String fullLogFileName = (logHome + "/" + DEFAULT_LOG_NAME);
    String fullScriptLogFileName = (logHome + "/" + DEFAULT_SCRIPT_LOG_NAME);

    //create log properties file, if it does not exist
    createLogProperties(logHome);/*from www.  j a va  2s  .c o  m*/

    //start logging
    Properties p = new Properties();
    File f = new File(fullPropertiesName);
    try {
        File logFile = new File(logHome + "/" + DEFAULT_LOG_NAME);
        if (!logFile.exists())
            logFile.createNewFile();

        FileInputStream in = new FileInputStream(f);
        p.load(in);
        in.close();
        p.setProperty("log4j.appender.jmetrik-logger.File", fullLogFileName);
        p.setProperty("log4j.appender.jmetrik-script-logger.File", fullScriptLogFileName);

        FileOutputStream out = new FileOutputStream(new File(fullLogFileName));
        p.store(out, header);
        out.close();
        PropertyConfigurator.configure(p);
        logger.info("Logging started");

    } catch (IOException ex) {
        this.firePropertyChange("error", "", "Error - Unable to configure log.");
    }

}