--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/logging/logConfiguration.hpp Thu Sep 24 12:36:04 2015 +0200
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#ifndef SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
+#define SHARE_VM_LOGGING_LOGCONFIGURATION_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+class LogOutput;
+class LogDecorators;
+class LogTagLevelExpression;
+
+// Global configuration of logging. Handles parsing and configuration of the logging framework,
+// and manages the list of configured log outputs. The actual tag and level configuration is
+// kept implicitly in the LogTagSets and their LogOutputLists. During configuration the tagsets
+// are iterated over and updated accordingly.
+class LogConfiguration : public AllStatic {
+ private:
+ static LogOutput** _outputs;
+ static size_t _n_outputs;
+
+ // Create a new output. Returns NULL if failed.
+ static LogOutput* new_output(char* name, const char* options = NULL);
+
+ // Add an output to the list of configured outputs. Returns the assigned index.
+ static size_t add_output(LogOutput* out);
+
+ // Delete a configured output. The stderr/stdout outputs can not be removed.
+ // Output should be completely disabled before it is deleted.
+ static void delete_output(size_t idx);
+
+ // Disable all logging to the specified output and then delete it (unless it is stdout/stderr).
+ static void disable_output(size_t idx);
+
+ // Get output index by name. Returns SIZE_MAX if output not found.
+ static size_t find_output(const char* name);
+
+ // Configure output (add or update existing configuration) to log on tag-level combination using specified decorators.
+ static void configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators);
+
+ public:
+ // Initialization and finalization of log configuration, to be run at vm startup and shutdown respectively.
+ static void initialize(jlong vm_start_time);
+ static void finalize();
+
+ // Perform necessary post-initialization after VM startup. Enables reconfiguration of logging.
+ static void post_initialize();
+
+ // Disable all logging, equivalent to -Xlog:disable.
+ static void disable_logging();
+
+ // Parse command line configuration. Parameter 'opts' is the string immediately following the -Xlog: argument ("gc" for -Xlog:gc).
+ static bool parse_command_line_arguments(const char* opts = "all");
+
+ // Parse separated configuration arguments (from JCmd/MBean and command line).
+ static bool parse_log_arguments(const char* outputstr,
+ const char* what,
+ const char* decoratorstr,
+ const char* output_options,
+ outputStream* errstream);
+
+ // Prints log configuration to outputStream, used by JCmd/MBean.
+ static void describe(outputStream* out);
+
+ // Prints usage help for command line log configuration.
+ static void print_command_line_help(FILE* out);
+};
+
+#endif // SHARE_VM_LOGGING_LOGCONFIGURATION_HPP