18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.jcmd;
27
28
29
30 import java.io.IOException;
31 import java.nio.file.Files;
32 import java.nio.file.Paths;
33 import java.util.List;
34
35 import jdk.test.lib.dcmd.JcmdExecutor;
36 import jdk.test.lib.dcmd.PidJcmdExecutor;
37
38 /*
39 * @test TestJcmdLogLevelChange
40 * @key jfr
41 * @summary Test changing log level
42 *
43 * @library /test/lib /test/jdk
44 *
45 * @run main/othervm -Xlog:jfr=info jdk.jfr.jcmd.TestJcmdChangeLogLevel
46 */
47 public class TestJcmdChangeLogLevel {
48 public static void main(String[] args) throws Exception {
49 final String fileName = "jfr_trace.txt";
50 final String findWhat = "[info][jfr] Flight Recorder initialized";
51 boolean passed = false;
52
53 JcmdExecutor je = new PidJcmdExecutor();
54 je.execute("VM.log output='file=" + fileName + "' what='jfr=info'");
55 je.execute("JFR.start duration=1s");
56 List<String> lines;
57
58 do {
59 try {
60 lines = Files.readAllLines(Paths.get(fileName));
61 } catch (IOException e) {
|
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.jcmd;
27
28
29
30 import java.io.IOException;
31 import java.nio.file.Files;
32 import java.nio.file.Paths;
33 import java.util.List;
34
35 import jdk.test.lib.dcmd.JcmdExecutor;
36 import jdk.test.lib.dcmd.PidJcmdExecutor;
37
38 /**
39 * @test TestJcmdLogLevelChange
40 * @key jfr
41 * @summary Test changing log level
42 * @requires vm.hasJFR
43 *
44 * @library /test/lib /test/jdk
45 *
46 * @run main/othervm -Xlog:jfr=info jdk.jfr.jcmd.TestJcmdChangeLogLevel
47 */
48 public class TestJcmdChangeLogLevel {
49 public static void main(String[] args) throws Exception {
50 final String fileName = "jfr_trace.txt";
51 final String findWhat = "[info][jfr] Flight Recorder initialized";
52 boolean passed = false;
53
54 JcmdExecutor je = new PidJcmdExecutor();
55 je.execute("VM.log output='file=" + fileName + "' what='jfr=info'");
56 je.execute("JFR.start duration=1s");
57 List<String> lines;
58
59 do {
60 try {
61 lines = Files.readAllLines(Paths.get(fileName));
62 } catch (IOException e) {
|