RFR (L): 8046148: JEP 158 Unified JVM Logging

Staffan Larsen staffan.larsen at oracle.com
Tue Sep 15 13:57:16 UTC 2015


Like so:

$ java -Xlog:all::uptime,time,pid,tid,level,tags Hello
[2015-09-15T10:08:40.407-0100][0.203s][][][][][91539][4867][info   ][logging] Log configuration fully initialized.

or with default decorations:

$ java -Xlog:all Hello
[][0.203s][][][][][][][info   ][logging] Log configuration fully initialized.

Looks a bit ugly to me.


> On 15 sep 2015, at 15:47, Chris Newland <cnewland at chrisnewland.com> wrote:
> 
> Rather than decorating the values, would it be so bad to print empty
> brackets [] when a log field is ommitted?
> 
> Wastes 2 chars per ommitted field but reduces ambiguity and simplifies
> parsing?
> 
> -Chris
> 
> On Tue, September 15, 2015 13:46, Staffan Larsen wrote:
>> 
> 
>> Some way of differentiating the tid and pid decorations would be good.
>> Even if you specify them in a different order on the command line, they
>> will always show up in the same order which can be even more confusing.
>> 
>> Maybe prefix them with ‘p’ and ’t’:
>> 
>> 
>> [2015-09-15T10:08:40.407-0100][0.203s][p91539][t4867][info   ][logging]
>> Log configuration fully initialized.
>> 
>> 
>> Or postfix:
>> 
>> 
>> [2015-09-15T10:08:40.407-0100][0.203s][91539p][4867t][info   ][logging]
>> Log configuration fully initialized.
>> 
>> 
>> Or label (but this is getting verbose):
>> 
>> 
>> [2015-09-15T10:08:40.407-0100][0.203s][pid=91539][tid=4867][info
>> ][logging] Log configuration fully initialized.
>> 
>> 
>> Other ideas?
>> 
>> 
>> 
>> 
>>> On 15 sep 2015, at 14:27, Staffan Larsen <staffan.larsen at oracle.com>
>>> wrote:
>>> 
>>> 
>>> 
>>>> On 15 sep 2015, at 14:20, Kirk Pepperdine <kirk at kodewerk.com> wrote:
>>>> 
>>>> 
>>>> 
>>>>> 
>>>>> Just for completeness: there can be more than 3 bracket pairs if
>>>>> you configure additional decorations:
>>>>> 
>>>>> $ java -Xlog:all::uptime,time,pid,tid,level,tags Hello
>>>>> [2015-09-15T10:08:40.407-0100][0.203s][91539][4867][info
>>>>> ][logging] Log configuration fully initialized.
>>>>> 
>>>> 
>>>> Are there a finite number of decorations? Is the order fixed or how
>>>> would one tell the diff between pid and tid?
>>> 
>>> May I refer to the JEP:
>>> 
>>> 
>>> ------------
>>> Decorations
>>> 
>>> 
>>> Logging messages are decorated with information about the message. Here
>>> is a list of the possible decorations:
>>> 
>>> • time -- Current time and date in ISO-8601 format • uptime -- Time
>>> since the start of the JVM in seconds and milliseconds (e.g., 6.567s)
>>> • timemillis -- The same value as generated by
>>> System.currentTimeMillis()
>>> • uptimemillis -- Milliseconds since the JVM started • timenanos --
>>> The same value as generated by System.nanoTime()
>>> • uptimenanos -- Nanoseconds since the JVM started • pid -- The
>>> process identifier • tid -- The thread identifier • level -- The
>>> level associated with the log message • tags -- The tag-set associated
>>> with the log message Each output can be configured to use a custom set
>>> of decorators. The order of them is always the one above though. The
>>> decorations to be used can be configured by the user in runtime.
>>> Decorations will be prepended to the log message
>>> 
>>> 
>>> Example: [6.567s][info][gc,old] Old collection complete
>>> 
>>> 
>>> ------------
>>> 
>>> 
>>> 
>> 
>> 
> 
> 



More information about the hotspot-dev mailing list