Example usage for java.util.logging Level ALL

List of usage examples for java.util.logging Level ALL

Introduction

In this page you can find the example usage for java.util.logging Level ALL.

Prototype

Level ALL

To view the source code for java.util.logging Level ALL.

Click Source Link

Document

ALL indicates that all messages should be logged.

Usage

From source file:hudson.plugins.active_directory.docker.TheFlintstonesTest.java

private List<String> captureLogMessages(int size) {
    final List<String> logMessages = new ArrayList<>(size);
    Logger logger = Logger.getLogger("");
    logger.setLevel(Level.ALL);

    RingBufferLogHandler ringHandler = new RingBufferLogHandler(size) {

        final Formatter f = new SimpleFormatter(); // placeholder instance for what should have been a static method perhaps

        @Override//from w  w  w .  j av  a 2s.co  m
        public synchronized void publish(LogRecord record) {
            super.publish(record);
            String message = f.formatMessage(record);
            Throwable x = record.getThrown();
            logMessages.add(message == null && x != null ? x.toString() : message);
        }
    };
    logger.addHandler(ringHandler);

    return logMessages;
}

From source file:de.mendelson.comm.as2.client.AS2Gui.java

/**
 * Creates new form NewJFrame//from  ww  w .j  a va2s.  c  om
 */
public AS2Gui(Splash splash, String host) {
    this.host = host;
    //Set System default look and feel
    try {
        //support the command line option -Dswing.defaultlaf=...
        if (System.getProperty("swing.defaultlaf") == null) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
    } catch (Exception e) {
        this.logger.warning(this.getClass().getName() + ":" + e.getMessage());
    }
    //load resource bundle
    try {
        this.rb = (MecResourceBundle) ResourceBundle.getBundle(ResourceBundleAS2Gui.class.getName());
    } catch (MissingResourceException e) {
        throw new RuntimeException("Oops..resource bundle " + e.getClassName() + " not found.");
    }
    initComponents();
    this.jButtonNewVersion.setVisible(false);
    this.jPanelRefreshWarning.setVisible(false);
    //set preference values to the GUI
    this.setBounds(this.clientPreferences.getInt(PreferencesAS2.FRAME_X),
            this.clientPreferences.getInt(PreferencesAS2.FRAME_Y),
            this.clientPreferences.getInt(PreferencesAS2.FRAME_WIDTH),
            this.clientPreferences.getInt(PreferencesAS2.FRAME_HEIGHT));
    //ensure to display all messages
    this.getLogger().setLevel(Level.ALL);
    LogConsolePanel consolePanel = new LogConsolePanel(this.getLogger());
    //define the colors for the log levels
    consolePanel.setColor(Level.SEVERE, LogConsolePanel.COLOR_BROWN);
    consolePanel.setColor(Level.WARNING, LogConsolePanel.COLOR_BLUE);
    consolePanel.setColor(Level.INFO, LogConsolePanel.COLOR_BLACK);
    consolePanel.setColor(Level.CONFIG, LogConsolePanel.COLOR_DARK_GREEN);
    consolePanel.setColor(Level.FINE, LogConsolePanel.COLOR_DARK_GREEN);
    consolePanel.setColor(Level.FINER, LogConsolePanel.COLOR_DARK_GREEN);
    consolePanel.setColor(Level.FINEST, LogConsolePanel.COLOR_DARK_GREEN);
    this.jPanelServerLog.add(consolePanel);
    this.setTitle(AS2ServerVersion.getProductName() + " " + AS2ServerVersion.getVersion());
    //initialize the help system if available
    this.initializeJavaHelp();
    this.jTableMessageOverview.getSelectionModel().addListSelectionListener(this);
    this.jTableMessageOverview.getTableHeader().setReorderingAllowed(false);
    //icon columns
    TableColumn column = this.jTableMessageOverview.getColumnModel().getColumn(0);
    column.setMaxWidth(20);
    column.setResizable(false);
    column = this.jTableMessageOverview.getColumnModel().getColumn(1);
    column.setMaxWidth(20);
    column.setResizable(false);
    this.jTableMessageOverview.setDefaultRenderer(Date.class,
            new TableCellRendererDate(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)));
    //add row sorter
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(this.jTableMessageOverview.getModel());
    jTableMessageOverview.setRowSorter(sorter);
    sorter.addRowSorterListener(this);
    this.jPanelFilterOverview.setVisible(this.showFilterPanel);
    this.jMenuItemHelpForum.setEnabled(Desktop.isDesktopSupported());
    //destroy splash, possible login screen for the client should come up
    if (splash != null) {
        splash.destroy();
    }
    this.setButtonState();
    this.jTableMessageOverview.addMouseListener(this);
    //popup menu issues
    this.jPopupMenu.setInvoker(this.jScrollPaneMessageOverview);
    this.jPopupMenu.addPopupMenuListener(this);
    super.addMessageProcessor(this);
    //perform the connection to the server
    //warning! this works for localhost only so far
    int clientServerCommPort = this.clientPreferences.getInt(PreferencesAS2.CLIENTSERVER_COMM_PORT);
    if (splash != null) {
        splash.destroy();
    }
    this.browserLinkedPanel.cyleText(new String[] {
            "For additional EDI software to convert and process your data please contact <a href='http://www.mendelson-e-c.com'>mendelson-e-commerce GmbH</a>",
            "To buy a commercial license please visit the <a href='http://shop.mendelson-e-c.com/'>mendelson online shop</a>",
            "Most trading partners demand a trusted certificate - Order yours at the <a href='http://ca.mendelson-e-c.com'>mendelson CA</a> now!",
            "Looking for additional secure data transmission software? Try the <a href='http://oftp2.mendelson-e-c.com'>mendelson OFTP2</a> solution!",
            "You want to send EDIFACT data from your SAP system? Ask <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20SAP%20integration%20solutions'>mendelson-e-commerce GmbH</a> for a solution.",
            "You need a secure FTP solution? <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20SFTP%20solution'>Ask us</a> for the mendelson SFTP software.",
            "Convert flat files, EDIFACT, SAP IDos, VDA, inhouse formats? <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20converter%20solution'>Ask us</a> for the mendelson EDI converter.",
            "For commercial support of this software please buy a license at <a href='http://as2.mendelson-e-c.com'>the mendelson AS2</a> website.",
            "Have a look at the <a href='http://www.mendelson-e-c.com/products_mbi.php'>mendelson business integration</a> for a powerful EDI solution.",
            "The <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20RosettaNet%20solution'>mendelson RosettaNet solution</a> supports RNIF 1.1 and RNIF 2.0.",
            "The <a href='http://www.mendelson-e-c.com/products_ide.php'>mendelson converter IDE</a> is the graphical mapper for the mendelson converter.",
            "To process any XML data and convert it to EDIFACT, VDA, flat files, IDocs and inhouse formats use <a href='http://www.mendelson-e-c.com/products_converter.php'>the mendelson converter</a>.",
            "To transmit your EDI data via HTTP/S please <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20HTTPS%20solution'>ask us</a> for the mendelson HTTPS solution.",
            "If you have questions regarding this product please refer to the <a href='http://community.mendelson-e-c.com/'>mendelson community</a>.", });
    this.connect(new InetSocketAddress(host, clientServerCommPort), 5000);
    Runnable dailyNewsThread = new Runnable() {

        @Override
        public void run() {
            while (true) {
                long lastUpdateCheck = Long.valueOf(clientPreferences.get(PreferencesAS2.LAST_UPDATE_CHECK));
                //check only once a day even if the system is started n times a day
                if (lastUpdateCheck < (System.currentTimeMillis() - TimeUnit.HOURS.toMillis(23))) {
                    clientPreferences.put(PreferencesAS2.LAST_UPDATE_CHECK,
                            String.valueOf(System.currentTimeMillis()));
                    jButtonNewVersion.setVisible(false);
                    String version = (AS2ServerVersion.getVersion() + " " + AS2ServerVersion.getBuild())
                            .replace(' ', '+');
                    Header[] header = htmlPanel.setURL(
                            "http://www.mendelson.de/en/mecas2/client_welcome.php?version=" + version,
                            AS2ServerVersion.getProductName() + " " + AS2ServerVersion.getVersion(),
                            new File("start/client_welcome.html"));
                    if (header != null) {
                        String downloadURL = null;
                        String actualBuild = null;
                        for (Header singleHeader : header) {
                            if (singleHeader.getName().equals("x-actual-build")) {
                                actualBuild = singleHeader.getValue().trim();
                            }
                            if (singleHeader.getName().equals("x-download-url")) {
                                downloadURL = singleHeader.getValue().trim();
                            }
                        }
                        if (downloadURL != null && actualBuild != null) {
                            try {
                                int thisBuild = AS2ServerVersion.getBuildNo();
                                int availableBuild = Integer.valueOf(actualBuild);
                                if (thisBuild < availableBuild) {
                                    jButtonNewVersion.setVisible(true);
                                }
                                downloadURLNewVersion = downloadURL;
                            } catch (Exception e) {
                                //nop
                            }
                        }
                    }
                } else {
                    htmlPanel.setPage(new File("start/client_welcome.html"));
                }
                try {
                    //check once a day for new update
                    Thread.sleep(TimeUnit.DAYS.toMillis(1));
                } catch (InterruptedException e) {
                    //nop
                }
            }
        }
    };
    Executors.newSingleThreadExecutor().submit(dailyNewsThread);
    this.as2StatusBar.setConnectedHost(this.host);
}

From source file:org.jenkinsci.plugins.workflow.support.steps.ExecutorStepTest.java

@Test
public void buildShellScriptAcrossRestart() throws Exception {
    Assume.assumeFalse("TODO not sure how to write a corresponding batch script", Functions.isWindows());
    story.addStep(new Statement() {
        @SuppressWarnings("SleepWhileInLoop")
        @Override//  w  w w .jav  a2s.  c om
        public void evaluate() throws Throwable {
            Logger LOGGER = Logger.getLogger(DurableTaskStep.class.getName());
            LOGGER.setLevel(Level.FINE);
            Handler handler = new ConsoleHandler();
            handler.setLevel(Level.ALL);
            LOGGER.addHandler(handler);
            // Cannot use regular JenkinsRule.createSlave due to JENKINS-26398.
            // Nor can we can use JenkinsRule.createComputerLauncher, since spawned commands are killed by CommandLauncher somehow (it is not clear how; apparently before its onClosed kills them off).
            DumbSlave s = new DumbSlave("dumbo", "dummy", tmp.getRoot().getAbsolutePath(), "1",
                    Node.Mode.NORMAL, "", new JNLPLauncher(), RetentionStrategy.NOOP,
                    Collections.<NodeProperty<?>>emptyList());
            story.j.jenkins.addNode(s);
            startJnlpProc();
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "demo");
            File f1 = new File(story.j.jenkins.getRootDir(), "f1");
            File f2 = new File(story.j.jenkins.getRootDir(), "f2");
            new FileOutputStream(f1).close();
            p.setDefinition(new CpsFlowDefinition("node('dumbo') {\n" + "    sh 'touch \"" + f2
                    + "\"; while [ -f \"" + f1 + "\" ]; do sleep 1; done; echo finished waiting; rm \"" + f2
                    + "\"'\n" + "    echo 'OK, done'\n" + "}", true));
            WorkflowRun b = p.scheduleBuild2(0).waitForStart();
            while (!f2.isFile()) {
                Thread.sleep(100);
            }
            assertTrue(b.isBuilding());
            killJnlpProc();
        }
    });
    story.addStep(new Statement() {
        @Override
        public void evaluate() throws Throwable {
            WorkflowJob p = (WorkflowJob) story.j.jenkins.getItem("demo");
            WorkflowRun b = p.getLastBuild();
            assertTrue(b.isBuilding()); // TODO occasionally fails; log ends with: Running: Allocate node : Body : Start (no shell step in sight)
            startJnlpProc(); // Have to relaunch JNLP agent, since the Jenkins port has changed, and we cannot force JenkinsRule to reuse the same port as before.
            File f1 = new File(story.j.jenkins.getRootDir(), "f1");
            File f2 = new File(story.j.jenkins.getRootDir(), "f2");
            assertTrue(f2.isFile());
            assertTrue(f1.delete());
            while (f2.isFile()) {
                Thread.sleep(100);
            }
            story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b));
            story.j.assertLogContains("finished waiting", b);
            story.j.assertLogContains("OK, done", b);
            killJnlpProc();
        }
    });
}

From source file:io.github.agentsoz.abmjadex.super_central.ABMSimStarter.java

private static void parsingArguments(String[] args, Options options) {
    //flags/*from www. jav a 2s .c o  m*/
    boolean isRunningCO = true;
    boolean isForced = false; //Overwrite any existing CO xml file
    boolean isRunningSC = true;
    boolean isLogToConsole = false;
    Level logLevel = Level.INFO;

    Properties prop = null;
    CommandLine line = null;
    BasicParser parser = new BasicParser();
    ArrayList<String> argsList = new ArrayList<String>();

    //Initialize argsList with args
    for (int i = 0; i < args.length; i++) {
        argsList.add(args[i]);
    }

    //Update 04/17/2013
    String[] specificArgs = packageOptionSpecific(args);

    try {
        // parse the command line arguments
        //line = parser.parse(options, args );
        //Update 04/17/2013
        line = parser.parse(options, specificArgs);

        //Commandline required -prop argument to be filled with valid properties file location
        if (line.hasOption(HELP)) {
            //Remove app specific arguments from total arguments
            int helpIndex = argsList.indexOf("-" + HELP);
            if (helpIndex == -1)
                helpIndex = argsList.indexOf("-" + HELP_LONG);
            argsList.remove(helpIndex);

            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("Jadex-ABMS", options);
        }

        if (line.hasOption(PROP)) {
            //Remove app specific arguments from total arguments
            int propIndex = argsList.indexOf("-" + PROP);
            if (propIndex == -1)
                propIndex = argsList.indexOf("-" + PROP_LONG);
            argsList.remove(propIndex + 1);
            argsList.remove(propIndex);

            String propertiesLoc = line.getOptionValue(PROP).replace("\\", "/").replace("\\\\", "/");
            prop = new Properties();

            try {
                prop.load(new FileInputStream(propertiesLoc));
                //Parsing options value into local flags------------------------
                if (line.hasOption(MODE)) {
                    String mode = line.getOptionValue(MODE);
                    if (mode.equalsIgnoreCase(CO_ONLY)) {
                        isRunningSC = false;
                    } else if (mode.equalsIgnoreCase(SC_CO)) {
                        //Default value is to run an SC and a CO
                    } else if (mode.equalsIgnoreCase(SC_ONLY)) {
                        isRunningCO = false;
                    } else {
                        throw new ParseException("Wrong argument for -mode.");
                    }

                    //Remove app specific arguments from total arguments
                    int modeIndex = argsList.indexOf("-" + MODE);
                    argsList.remove(modeIndex + 1);
                    argsList.remove(modeIndex);
                }

                if (line.hasOption(FORCED)) {
                    isForced = true;
                    //Remove app specific arguments from total arguments
                    int modeIndex = argsList.indexOf("-" + FORCED);
                    if (modeIndex == -1)
                        modeIndex = argsList.indexOf("-" + FORCED_LONG);
                    argsList.remove(modeIndex);
                }

                if (line.hasOption(GUI)) {
                    String guiMode = line.getOptionValue(GUI);
                    if (!guiMode.equalsIgnoreCase("true") && !guiMode.equalsIgnoreCase("false"))
                        throw new ParseException("Wrong argument for -gui.");
                } else {
                    argsList.add("-" + GUI);
                    int guiIndex = argsList.indexOf("-" + GUI);
                    argsList.add(guiIndex + 1, "false");
                }

                if (line.hasOption(LOG_CONSOLE)) {
                    isLogToConsole = true;
                    //Remove app specific arguments from total arguments
                    int logCIndex = argsList.indexOf("-" + LOG_CONSOLE);
                    argsList.remove(logCIndex);
                }

                if (line.hasOption(LOG_LVL)) {
                    String level = line.getOptionValue(LOG_LVL);
                    if (level.equalsIgnoreCase("INFO")) {
                        logLevel = Level.INFO;
                    } else if (level.equalsIgnoreCase("ALL")) {
                        logLevel = Level.ALL;
                    } else if (level.equalsIgnoreCase("CONFIG")) {
                        logLevel = Level.CONFIG;
                    } else if (level.equalsIgnoreCase("FINE")) {
                        logLevel = Level.FINE;
                    } else if (level.equalsIgnoreCase("FINER")) {
                        logLevel = Level.FINER;
                    } else if (level.equalsIgnoreCase("FINEST")) {
                        logLevel = Level.FINEST;
                    } else if (level.equalsIgnoreCase("OFF")) {
                        logLevel = Level.OFF;
                    } else if (level.equalsIgnoreCase("SEVERE")) {
                        logLevel = Level.SEVERE;
                    } else if (level.equalsIgnoreCase("WARNING")) {
                        logLevel = Level.WARNING;
                    } else {
                        throw new ParseException("argument for loglvl unknown");
                    }
                    //Remove app specific arguments from total arguments
                    int logLvlIndex = argsList.indexOf("-" + LOG_LVL);
                    argsList.remove(logLvlIndex + 1);
                    argsList.remove(logLvlIndex);
                }

                //Setup logger
                try {
                    ABMBDILoggerSetter.initialized(prop, isLogToConsole, logLevel);
                    ABMBDILoggerSetter.setup(LOGGER);
                } catch (IOException e) {
                    e.printStackTrace();
                    LOGGER.severe(e.getMessage());
                    throw new RuntimeException("Problems with creating logfile");
                }

                //Translate argsList into array------------------------------
                String[] newargs = new String[argsList.size()];
                for (int i = 0; i < argsList.size(); i++) {
                    newargs[i] = argsList.get(i);
                }

                //Running the system----------------------------------------
                if (isRunningSC == true) {
                    runSC(prop);
                }

                if (isRunningCO == true) {
                    runCO(prop, newargs, isForced);
                }

            } catch (IOException e) {
                e.printStackTrace();
                LOGGER.severe(e.getMessage());
            }
        } else {
            throw new ParseException("-prop <properties_location> is a required option");
        }

    } catch (ParseException exp) {
        LOGGER.severe("Unexpected exception:" + exp.getMessage());

        //If its not working print out help info
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("Jadex-ABMS", options);
    }
}

From source file:org.callimachusproject.repository.CalliRepository.java

@Override
public void setLoggingCalls(boolean trace) {
    if (trace) {//from ww w. j a  v  a 2  s .  c om
        setTracingCalls(trace);
        setLoggerLevel("org.openrdf.repository", Level.ALL);
        setLoggerLevel("org.openrdf.query", Level.ALL);
        setLoggerLevel("org.openrdf.model", Level.ALL);
    } else {
        setLoggerLevel("org.openrdf.repository", Level.INFO);
        setLoggerLevel("org.openrdf.query", Level.INFO);
        setLoggerLevel("org.openrdf.model", Level.INFO);
    }
}

From source file:edu.harvard.iq.dvn.core.harvest.HarvesterServiceBean.java

/**
 * This method is called whenever an EJB Timer goes off.
 * Check to see if this is a Harvest Timer, and if it is
 * Run the harvest for the given (scheduled) dataverse
 * @param timer/*from  ww w.jav a  2 s  . c  o m*/
 */
@Timeout
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void handleTimeout(javax.ejb.Timer timer) {
    // We have to put all the code in a try/catch block because
    // if an exception is thrown from this method, Glassfish will automatically
    // call the method a second time. (The minimum number of re-tries for a Timer method is 1)

    if (timer.getInfo() instanceof HarvestTimerInfo) {
        HarvestTimerInfo info = (HarvestTimerInfo) timer.getInfo();
        try {
            // First, check if we are in read-only mode: 

            if (vdcNetworkService.defaultTransactionReadOnly()) {
                logger.log(Level.ALL, "Network is in read-only mode.");
                return;

            }

            // Proceeding with the scheduled harvest: 

            logger.log(Level.INFO, "DO HARVESTING of dataverse " + info.getHarvestingDataverseId());
            doHarvesting(info.getHarvestingDataverseId());

        } catch (Throwable e) {
            harvestingDataverseService.setHarvestResult(info.getHarvestingDataverseId(),
                    HarvestingDataverse.HARVEST_RESULT_FAILED);
            mailService.sendHarvestErrorNotification(vdcNetworkService.find().getSystemEmail(),
                    vdcNetworkService.find().getName());
            logException(e, logger);
        }
    }
}

From source file:org.syncany.cli.CommandLineClient.java

private void initLogLevel(OptionSet options, OptionSpec<Void> optionDebug, OptionSpec<String> optionLogLevel) {
    Level newLogLevel = null;//from  w w  w.  j a v a  2 s.  c o m

    // --debug
    if (options.has(optionDebug)) {
        newLogLevel = Level.ALL;
    }

    // --loglevel=<level>
    else if (options.has(optionLogLevel)) {
        String newLogLevelStr = options.valueOf(optionLogLevel);

        try {
            newLogLevel = Level.parse(newLogLevelStr);
        } catch (IllegalArgumentException e) {
            showErrorAndExit("Invalid log level given " + newLogLevelStr + "'");
        }
    } else {
        newLogLevel = Level.INFO;
    }

    // Add handler to existing loggers, and future ones
    Logging.setGlobalLogLevel(newLogLevel);

    // Debug output
    if (options.has(optionDebug)) {
        out.println("debug");
        out.println(String.format("Application version: %s", Client.getApplicationVersionFull()));

        logger.log(Level.INFO, "Application version: {0}", Client.getApplicationVersionFull());
    }
}

From source file:org.springframework.shell.core.JLineShell.java

private void flashMessageRenderer() {
    if (!reader.getTerminal().isANSISupported()) {
        return;//from w w  w . j av a  2s.com
    }
    // Setup a thread to ensure flash messages are displayed and cleared correctly
    Thread t = new Thread(new Runnable() {
        public void run() {
            while (!shellStatus.getStatus().equals(Status.SHUTTING_DOWN) && !shutdownHookFired) {
                synchronized (flashInfoMap) {
                    long now = System.currentTimeMillis();

                    Set<String> toRemove = new HashSet<String>();
                    for (String slot : flashInfoMap.keySet()) {
                        FlashInfo flashInfo = flashInfoMap.get(slot);

                        if (flashInfo.flashMessageUntil < now) {
                            // Message has expired, so clear it
                            toRemove.add(slot);
                            doAnsiFlash(flashInfo.rowNumber, Level.ALL, "");
                        } else {
                            // The expiration time for this message has not been reached, so preserve it
                            doAnsiFlash(flashInfo.rowNumber, flashInfo.flashLevel, flashInfo.flashMessage);
                        }
                    }
                    for (String slot : toRemove) {
                        flashInfoMap.remove(slot);
                    }
                }
                try {
                    Thread.sleep(200);
                } catch (InterruptedException ignore) {
                }
            }
        }
    }, getProductName() + " JLine Flash Message Manager");
    t.start();
}

From source file:org.jenkinsci.plugins.workflow.support.steps.ExecutorStepTest.java

@Test
public void buildShellScriptAcrossDisconnect() throws Exception {
    Assume.assumeFalse("TODO not sure how to write a corresponding batch script", Functions.isWindows());
    story.addStep(new Statement() {
        @SuppressWarnings("SleepWhileInLoop")
        @Override//from  w  ww. j  av a  2s  . co m
        public void evaluate() throws Throwable {
            Logger LOGGER = Logger.getLogger(DurableTaskStep.class.getName());
            LOGGER.setLevel(Level.FINE);
            Handler handler = new ConsoleHandler();
            handler.setLevel(Level.ALL);
            LOGGER.addHandler(handler);
            DumbSlave s = new DumbSlave("dumbo", "dummy", tmp.getRoot().getAbsolutePath(), "1",
                    Node.Mode.NORMAL, "", new JNLPLauncher(), RetentionStrategy.NOOP,
                    Collections.<NodeProperty<?>>emptyList());
            story.j.jenkins.addNode(s);
            startJnlpProc();
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "demo");
            File f1 = new File(story.j.jenkins.getRootDir(), "f1");
            File f2 = new File(story.j.jenkins.getRootDir(), "f2");
            new FileOutputStream(f1).close();
            p.setDefinition(new CpsFlowDefinition("node('dumbo') {\n" + "    sh 'touch \"" + f2
                    + "\"; while [ -f \"" + f1 + "\" ]; do sleep 1; done; echo finished waiting; rm \"" + f2
                    + "\"'\n" + "    echo 'OK, done'\n" + "}", true));
            WorkflowRun b = p.scheduleBuild2(0).waitForStart();
            while (!f2.isFile()) {
                Thread.sleep(100);
            }
            assertTrue(b.isBuilding());
            Computer c = s.toComputer();
            assertNotNull(c);
            killJnlpProc();
            while (c.isOnline()) {
                Thread.sleep(100);
            }
            startJnlpProc();
            while (c.isOffline()) {
                Thread.sleep(100);
            }
            assertTrue(f2.isFile());
            assertTrue(f1.delete());
            while (f2.isFile()) {
                Thread.sleep(100);
            }
            story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b));
            story.j.assertLogContains("finished waiting", b); // TODO sometimes is not printed to log, despite f2 having been removed
            story.j.assertLogContains("OK, done", b);
            killJnlpProc();
        }
    });
}

From source file:hu.sztaki.lpds.pgportal.portlets.asm.ClientError.java

public void throwError(String message, int prio) {
    System.out.print(prio + "# [ERROR] " + message);
    Logger.getLogger(ASM_SamplePortlet.class.getName()).log(Level.ALL, message);
    errorMessage = message;//from w  w  w.  j  av a 2s.c o m
}