4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #ifndef SHARE_VM_LOGGING_LOGDIAGNOSTICCOMMAND_HPP_
25 #define SHARE_VM_LOGGING_LOGDIAGNOSTICCOMMAND_HPP_
26 #include "services/diagnosticCommand.hpp"
27
28 // The LogDiagnosticCommand represents the 'VM.log' DCMD
29 // that allows configuration of the logging at runtime.
30 // It can be used to view or modify the current log configuration.
31 // VM.log without additional arguments prints the usage description.
32 // The 'list' argument will list all available log tags,
33 // levels, decorators and currently configured log outputs.
34 // Specifying 'disable' will disable logging completely.
35 // The remaining arguments are used to set a log output to log everything
36 // with the specified tags and levels using the given decorators.
37 class LogDiagnosticCommand : public DCmdWithParser {
38 protected:
39 DCmdArgument<char *> _output;
40 DCmdArgument<char *> _output_options;
41 DCmdArgument<char *> _what;
42 DCmdArgument<char *> _decorators;
43 DCmdArgument<bool> _disable;
44 DCmdArgument<bool> _list;
45
47 LogDiagnosticCommand(outputStream* output, bool heap_allocated);
48 void execute(DCmdSource source, TRAPS);
49 static void registerCommand();
50 static int num_arguments();
51
52 static const char* name() {
53 return "VM.log";
54 }
55
56 static const char* description() {
57 return "Lists, enables, disables or changes a log output configuration.";
58 }
59
60 // Used by SecurityManager. This DCMD requires ManagementPermission = control.
61 static const JavaPermission permission() {
62 JavaPermission p = {"java.lang.management.ManagementPermission", "control", NULL};
63 return p;
64 }
65 };
66
67 #endif
|
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #ifndef SHARE_VM_LOGGING_LOGDIAGNOSTICCOMMAND_HPP
25 #define SHARE_VM_LOGGING_LOGDIAGNOSTICCOMMAND_HPP
26
27 #include "services/diagnosticCommand.hpp"
28
29 // The LogDiagnosticCommand represents the 'VM.log' DCMD
30 // that allows configuration of the logging at runtime.
31 // It can be used to view or modify the current log configuration.
32 // VM.log without additional arguments prints the usage description.
33 // The 'list' argument will list all available log tags,
34 // levels, decorators and currently configured log outputs.
35 // Specifying 'disable' will disable logging completely.
36 // The remaining arguments are used to set a log output to log everything
37 // with the specified tags and levels using the given decorators.
38 class LogDiagnosticCommand : public DCmdWithParser {
39 protected:
40 DCmdArgument<char *> _output;
41 DCmdArgument<char *> _output_options;
42 DCmdArgument<char *> _what;
43 DCmdArgument<char *> _decorators;
44 DCmdArgument<bool> _disable;
45 DCmdArgument<bool> _list;
46
48 LogDiagnosticCommand(outputStream* output, bool heap_allocated);
49 void execute(DCmdSource source, TRAPS);
50 static void registerCommand();
51 static int num_arguments();
52
53 static const char* name() {
54 return "VM.log";
55 }
56
57 static const char* description() {
58 return "Lists, enables, disables or changes a log output configuration.";
59 }
60
61 // Used by SecurityManager. This DCMD requires ManagementPermission = control.
62 static const JavaPermission permission() {
63 JavaPermission p = {"java.lang.management.ManagementPermission", "control", NULL};
64 return p;
65 }
66 };
67
68 #endif // SHARE_VM_LOGGING_LOGDIAGNOSTICCOMMAND_HPP
|