Path: blob/master/src/hotspot/share/logging/logDiagnosticCommand.hpp
40930 views
/*1* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23#ifndef SHARE_LOGGING_LOGDIAGNOSTICCOMMAND_HPP24#define SHARE_LOGGING_LOGDIAGNOSTICCOMMAND_HPP2526#include "services/diagnosticCommand.hpp"2728// The LogDiagnosticCommand represents the 'VM.log' DCMD29// 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 everything36// with the specified tags and levels using the given decorators.37class LogDiagnosticCommand : public DCmdWithParser {38protected:39DCmdArgument<char *> _output;40DCmdArgument<char *> _output_options;41DCmdArgument<char *> _what;42DCmdArgument<char *> _decorators;43DCmdArgument<bool> _disable;44DCmdArgument<bool> _list;45DCmdArgument<bool> _rotate;4647public:48LogDiagnosticCommand(outputStream* output, bool heap_allocated);49void execute(DCmdSource source, TRAPS);50static void registerCommand();51static int num_arguments();5253static const char* name() {54return "VM.log";55}5657static const char* description() {58return "Lists current log configuration, enables/disables/configures a log output, or rotates all logs.";59}6061// Used by SecurityManager. This DCMD requires ManagementPermission = control.62static const JavaPermission permission() {63JavaPermission p = {"java.lang.management.ManagementPermission", "control", NULL};64return p;65}66};6768#endif // SHARE_LOGGING_LOGDIAGNOSTICCOMMAND_HPP697071