Command-line options

The new command-line option, -Xlog, is a crucial component of Java's logging framework. This command-line option has an extensive array of parameters and possibilities. The basic syntax is simply -Xlog, followed by an option.

Here is the formal basic syntax: 

-Xlog[:option]

Here is a basic example with all option: 

-Xlog:all

Here is the extensive command-line syntax used to configure the new, unified logging: 

-Xlog[:option]
option := [<what>][:[<output>][:[<decorators>][:<outputoptions>]]]
'help'
'disable'

what := <selector>[,...]
selector := <tag-set>[*][=<level>]
tag-set := <tag>[+..]
'all'
tag := name of tag
level := trace
debug
info
warning
error

output := 'stderr'
'stdout'
[file=]<filename>
decorators := <decorator>[,...]
'none'

decorator := time
uptime
timemillis
uptimemillis
timenanos
uptimenanos
pid
tid
level
tags
output-options := <output_option>[,...]
output-option := filecount=<file count>
filesize=<file size in kb>
parameter=value

The following -Xlog examples are followed by a description:

-Xlog:all

In the preceding example, we are telling the JVM to take the following actions:

  • Log all messages
  • Use the info level
  • Provide output to stdout
With this example, all warning messages will still be output to stderr.

The following example, logs messages at the debug level:

-Xlog:gc+rt*=debug

In the preceding example, we are telling the JVM to take the following actions:

  • Log all messages tagged with, at a minimum, the gc and rt tags
  • Use the debug level
  • Provide output to stdout

The following example pushes the output to an external file:

-Xlog:disable - Xlog:rt=debug:rtdebug.txt

In the preceding example, we are telling the JVM to take the following actions:

  • Disable all messages except those tagged with rt tags
  • Use the debug level
  • Provide output to a file named rtdebug.txt
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset