/*
 * Zed Attack Proxy (ZAP) and its related class files.
 * 
 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
 * 
 * Copyright 2015 The ZAP Development Team
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.zaproxy.zap;

import org.apache.commons.configuration.ConfigurationUtils;
import org.apache.commons.configuration.DefaultFileSystem;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.varia.NullAppender;
import org.parosproxy.paros.CommandLine;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.model.Model;
import org.zaproxy.zap.control.ControlOverrides;

/**
 * ZAP's bootstrap process.
 * <p>
 * The bootstrap process consists, basically, in initialising the singletons {@code Model}, {@code Control} and, for
 * non-headless modes, the {@code View} and handling of command line arguments.
 * 
 * @since 2.4.2
 * @see Model
 * @see org.parosproxy.paros.control.Control
 * @see org.parosproxy.paros.view.View
 */
abstract class ZapBootstrap {

    private final CommandLine args;
    private final ControlOverrides controlOverrides;

    public ZapBootstrap(CommandLine args) {
        this.args = args;

        controlOverrides = new ControlOverrides();
        controlOverrides.setProxyPort(getArgs().getPort());
        controlOverrides.setProxyHost(getArgs().getHost());
        controlOverrides.setConfigs(getArgs().getConfigs());
        controlOverrides.setExperimentalDb(getArgs().isExperimentalDb());
    }

    /**
     * Starts the bootstrap process.
     *
     * @return the return code of the program
     */
    public int start() {
        // Nasty hack to prevent warning messages when running from the command line
        NullAppender na = new NullAppender();
        Logger.getRootLogger().addAppender(na);
        Logger.getRootLogger().setLevel(Level.OFF);
        Logger.getLogger(ConfigurationUtils.class).addAppender(na);
        Logger.getLogger(DefaultFileSystem.class).addAppender(na);

        try {
            Constant.getInstance();
        } catch (final Throwable e) {
            System.err.println(e.getMessage());
            return 1;
        }

        Constant.setLowMemoryOption(getArgs().isLowMem());

        return 0;
    }

    /**
     * Initialises the model, all bootstrap implementations should call this method after base {@code start()}.
     *
     * @throws Exception if an error occurs while initialising the {@code Model}
     * @see #start()
     * @see Model
     */
    protected void initModel() throws Exception {
        Model.getSingleton().init(getControlOverrides());
        Model.getSingleton().getOptionsParam().setGUI(getArgs().isGUI());
    }

    /**
     * Gets the command line arguments.
     *
     * @return the command line arguments
     */
    protected CommandLine getArgs() {
        return args;
    }

    /**
     * Gets the control overrides. Necessary for initialising {@code Control} and {@code Model} singletons.
     *
     * @return the control overrides
     * @see org.parosproxy.paros.control.Control
     * @see Model
     */
    protected ControlOverrides getControlOverrides() {
        return controlOverrides;
    }

    /**
     * Gets ZAP's starting message.
     *
     * @return the starting message
     */
    protected static String getStartingMessage() {
        return Constant.PROGRAM_NAME + " " + Constant.PROGRAM_VERSION + " started.";
    }
}

@@ -761,16 +761,104 @@
 y.zap;%0A%0A
+import java.text.DateFormat;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0A%0A
 import o
@@ -3963,83 +3963,395 @@
     
-return Constant.PROGRAM_NAME + %22 %22 + Constant.PROGRAM_VERSION + %22 started.%22
+DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);%0A        StringBuilder strBuilder = new StringBuilder(200);%0A        strBuilder.append(Constant.PROGRAM_NAME).append(' ').append(Constant.PROGRAM_VERSION);%0A        strBuilder.append(%22 started %22);%0A        strBuilder.append(dateFormat.format(new Date()));%0A        return strBuilder.toString()
 ;%0A  

Include date/time when logging that ZAP started