Different consoles for stderr and stdout in Intellij IDEA? - intellij-idea

Stderr and stdout messages appear in the same console log in IntelliJ IDEA (typically in black and in red). Is there a simple way to suppress either stderr or stdout messages or redirect the two different streams to different console windows?

How I deal with this situation is to redirect stdout to a file, such as stdout.log, when system begins.
Then Configuring IDEA's Run/Debug Configurations - Logs to add a log file that locate stdout.log
Thus, you can get stdin at console you just created and stderr at old output.

There is this plugin called Grep Console which allows you to use regex agasint the console outputs. Thus, it is possible to filter the outputs per your needs.

Related

Pipe console output of IntelliJ to a script

It is possible to pipe the console output of an intellij application to a bash command so I can pretty-print it on the console directly?
I know I can save the log output to a file, but I still want to keep it on the stout window only, but just parse it through a script.
Piping output is a feature of the terminal shell.
IntelliJ IDEA is not using a terminal to run your app, therefore it's not possible with the default Run/Debug configurations.
You could use an external tool that will open a command line shell and run your app there, but the shell has to be open in a separate window and it will not be possible to get the formatted output directly in the IDE.
There is a related feature request in YouTrack, but it's unlikely to be implemented soon.

JMeter Test Results Monitoring/ Analysis

I want to start load testing by running JMeter from command line for more accurate test results, but how can I monitor the run and then analyze the results after the test finishes.
You can generate JTL (JMeter results) file while executing the JMX (JMeter script) file from command line. A sample command for generating JTL file will look like this..
jmeter -n -t path-to-jmeterScript.jmx -l path-to-jtlFile.jtl
After completion of script execution you can open the JMeter GUI and simply open the JTL file in any listener (as per your requirement).
Most of the listeners in JMeter have an option to save the results into a file. This file contains usually not the report itself, but the samples which are generated by the tests. If you define this filename, you can generate the reports using these saved files. For example see http://jmeter.apache.org/usermanual/component_reference.html#Summary_Report .
If you run JMeter in command-line non-GUI mode passing results file name via -l parameter it will output results there. After test finishes you will be able to open the file with the Listener of your choice and perform the analysis.
By default JMeter writes results in chunks, if you need to monitor them in real time add the following line to user.properties file (lives under /bin folder of your JMeter installation)
jmeter.save.saveservice.autoflush=true
You can use other properties which names start with jmeter.save.saveservice.* to control what metrics you need to store. The list with default values can be seen in jmeter.properties file. See Apache JMeter Properties Customization Guide for more information on various JMeter properties types and ways of working with them.
You can also consider running your JMeter test via Taurus tool - it provides some statistics as the test goes either in console mode or via web interface.

null printing on console

This is my log4j configuration file, whenever I run the batch file to execute the test case, a number of nulls are printed on the console. I have no experience with log4j, but I guess I have not assigned testAppender to ConsoleAppender, then why it is printing on console.
log4j.logger.com.rbs.rmd_test_suite.util.TestSuiteLogger=DEBUG, testAppender
log4j.appender.testAppender=org.apache.log4j.RollingFileAppender
log4j.appender.testAppender.File= ../log/rmd_test_suite_info.log
log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.testAppender.layout.ConversionPattern=%m%n
log4j.appender.testAppender.append=true
#Prevent internal log4j DEBUG messages from polluting the output.
log4j.logger.org.apache.log4j.PropertyConfigurator=INFO
log4j.logger.org.apache.log4j.config.PropertySetter=INFO
log4j.logger.org.apache.log4j.FileAppender=INFO
#Disabling logging of external jars
log4j.rootLogger=Off
log4j.logger.org.openqa = OFF
I am using Selenium Web Driver API to automate test cases for an application. Any help is appreciated.
Logging in the file is perfectly fine. Problem is the nulls that are being printed on console.
One possible reason I can think of is, your log4j.properties file is not in the bin folder of your app.
Edited : Got it your rootLogger is OFF
log4j.rootLogger=Off
Instead use
log4j.rootLogger=ALL
log4j.logger.org.openqa=ALL
log4j.rootLogger=ALL, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Exporting the Bazaar log to a printable format?

I have a thesis project that requires a project log to be submitted along with my final paper. As part of that log I'd like to include the Bazaar revision log and all the messages that it contains but I'll need to have them in a printable format.
I was unable to find any export feature in the Bazaar Explorer tool but I hope it's still possible to do somehow. Any thoughts?
Thanks!
You can get log in the text format using command-line: bzr log > log.txt or via Bazaar Explorer with running All Commands dialog and select log command there and then copy the log from status window. Read the help for log command to find the appropriate options. You may want to use -n0 option and maybe --forward one.
For completeness, you can use the bzr-xmloutput plugin to get an xml version and then process that into exactly what you want.

capturing stderr and stdout from an already running process in solaris

I've got a process that is currently running (arserverd) that was started by user "remedy". I am able to log in as this user. I would like to capture stderr and stdout without restarting the process. Is this possible?
If the process is already running, you could use the truss command to intercept writes to file descriptor 1 or 2:
truss -w 1,2 -p pid_of_arserverd
Truss will output lines like
write(1, " m e s s a g e\n", 8) = 8
Truss is specific to Solaris. On linux systems, look for strace instead.
Truss will slow down the process that you're trussing somewhat, so it's not something you'd want to use all the time. If you're looking for a permanent solution, your best bet is probably to redirect stdout and stderr to a file when launching the program. You can regularly truncate the file to keep its size manageable. An alternate is to run the program within a screen session that you can reconnect to when you want to interact with the program.
I don't think so but you can try to read from /proc/PID/fd/1 for stdout and /proc/PID/fd/2 for stderr (replace PID with the PID of the process).