22 *
23 */
24 #ifndef SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
25 #define SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
26
27 #include "memory/allocation.hpp"
28 #include "utilities/globalDefinitions.hpp"
29
30 class LogOutput;
31 class LogDecorators;
32 class LogTagLevelExpression;
33
34 // Global configuration of logging. Handles parsing and configuration of the logging framework,
35 // and manages the list of configured log outputs. The actual tag and level configuration is
36 // kept implicitly in the LogTagSets and their LogOutputLists. During configuration the tagsets
37 // are iterated over and updated accordingly.
38 class LogConfiguration : public AllStatic {
39 private:
40 static LogOutput** _outputs;
41 static size_t _n_outputs;
42
43 // Create a new output. Returns NULL if failed.
44 static LogOutput* new_output(char* name, const char* options = NULL);
45
46 // Add an output to the list of configured outputs. Returns the assigned index.
47 static size_t add_output(LogOutput* out);
48
49 // Delete a configured output. The stderr/stdout outputs can not be removed.
50 // Output should be completely disabled before it is deleted.
51 static void delete_output(size_t idx);
52
53 // Disable all logging to the specified output and then delete it (unless it is stdout/stderr).
54 static void disable_output(size_t idx);
55
56 // Get output index by name. Returns SIZE_MAX if output not found.
57 static size_t find_output(const char* name);
58
59 // Configure output (add or update existing configuration) to log on tag-level combination using specified decorators.
60 static void configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators);
61
68 static void post_initialize();
69
70 // Disable all logging, equivalent to -Xlog:disable.
71 static void disable_logging();
72
73 // Parse command line configuration. Parameter 'opts' is the string immediately following the -Xlog: argument ("gc" for -Xlog:gc).
74 static bool parse_command_line_arguments(const char* opts = "all");
75
76 // Parse separated configuration arguments (from JCmd/MBean and command line).
77 static bool parse_log_arguments(const char* outputstr,
78 const char* what,
79 const char* decoratorstr,
80 const char* output_options,
81 outputStream* errstream);
82
83 // Prints log configuration to outputStream, used by JCmd/MBean.
84 static void describe(outputStream* out);
85
86 // Prints usage help for command line log configuration.
87 static void print_command_line_help(FILE* out);
88 };
89
90 #endif // SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
|
22 *
23 */
24 #ifndef SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
25 #define SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
26
27 #include "memory/allocation.hpp"
28 #include "utilities/globalDefinitions.hpp"
29
30 class LogOutput;
31 class LogDecorators;
32 class LogTagLevelExpression;
33
34 // Global configuration of logging. Handles parsing and configuration of the logging framework,
35 // and manages the list of configured log outputs. The actual tag and level configuration is
36 // kept implicitly in the LogTagSets and their LogOutputLists. During configuration the tagsets
37 // are iterated over and updated accordingly.
38 class LogConfiguration : public AllStatic {
39 private:
40 static LogOutput** _outputs;
41 static size_t _n_outputs;
42 static bool _post_initialized;
43
44 // Create a new output. Returns NULL if failed.
45 static LogOutput* new_output(char* name, const char* options = NULL);
46
47 // Add an output to the list of configured outputs. Returns the assigned index.
48 static size_t add_output(LogOutput* out);
49
50 // Delete a configured output. The stderr/stdout outputs can not be removed.
51 // Output should be completely disabled before it is deleted.
52 static void delete_output(size_t idx);
53
54 // Disable all logging to the specified output and then delete it (unless it is stdout/stderr).
55 static void disable_output(size_t idx);
56
57 // Get output index by name. Returns SIZE_MAX if output not found.
58 static size_t find_output(const char* name);
59
60 // Configure output (add or update existing configuration) to log on tag-level combination using specified decorators.
61 static void configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators);
62
69 static void post_initialize();
70
71 // Disable all logging, equivalent to -Xlog:disable.
72 static void disable_logging();
73
74 // Parse command line configuration. Parameter 'opts' is the string immediately following the -Xlog: argument ("gc" for -Xlog:gc).
75 static bool parse_command_line_arguments(const char* opts = "all");
76
77 // Parse separated configuration arguments (from JCmd/MBean and command line).
78 static bool parse_log_arguments(const char* outputstr,
79 const char* what,
80 const char* decoratorstr,
81 const char* output_options,
82 outputStream* errstream);
83
84 // Prints log configuration to outputStream, used by JCmd/MBean.
85 static void describe(outputStream* out);
86
87 // Prints usage help for command line log configuration.
88 static void print_command_line_help(FILE* out);
89
90 static bool is_post_initialized() {
91 return _post_initialized;
92 }
93
94 // Rotates all LogOutput
95 static void rotate_all_outputs();
96 };
97
98 #endif // SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
|