Skip to content

JSON log format #611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

JSON log format #611

wants to merge 2 commits into from

Conversation

jelovirt
Copy link
Member

@jelovirt jelovirt commented May 1, 2025

Description

Document strucutured log (JSON).

Fields in every log message

  • level — log level FATAL, ERROR, WARN, INFO, DEBUG, or TRACE
  • timestamp — message timestamp in ISO datatime format

Optional fields that are in some messages depending on message type

  • code — message ID
  • duration — duration of build/target/task in milliseconds
  • line — line number in the source document
  • location — source document that caused the log message
  • msg — message text
  • row — row number in the source document
  • stacktrace — error Java stack trace
  • target — Ant target name
  • task — Ant task name

Motivation and Context

Documents dita-ot/dita-ot#4581

How Has This Been Tested?

Type of Changes

  • New feature (non-breaking change which adds functionality)

jelovirt added 2 commits May 1, 2025 19:29
Signed-off-by: Jarno Elovirta <[email protected]>
Signed-off-by: Jarno Elovirta <[email protected]>
@jelovirt jelovirt added the enhancement Changes to an existing topic or feature label May 1, 2025
@jelovirt jelovirt added this to Next May 1, 2025
@jelovirt jelovirt moved this to Todo in Next May 1, 2025
Copy link
Member

@infotexture infotexture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start, with a few minor suggestions.

Not sure we need the list of fields in the command overview, but probably makes sense to add those to the logging topic and Xref there from the args topic.

<parmname>--logger</parmname>=<varname>json</varname>
</pt>
<pd>
<p>Generate a strucured log in JSON format. Each log message generated a JSON object on its own line. JSON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Generate a strucured log in JSON format. Each log message generated a JSON object on its own line. JSON
<p>Generate a structured log in JSON format. Each log message generates a JSON object on its own line. JSON

@@ -56,6 +56,11 @@
<parmname>--logfile</parmname>=<varname>file</varname> and specify the path to the log file.</p>
<p>Unless an absolute path is specified, the value will be interpreted relative to the current
directory.</p></li>
<li>Use <cmdname>dita</cmdname>
<parmname>--logger</parmname>=<varname>json</varname> to generate a strucured log in JSON format. Each log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<parmname>--logger</parmname>=<varname>json</varname> to generate a strucured log in JSON format. Each log
<parmname>--logger</parmname>=<varname>json</varname> to generate a structured log in JSON format. Each log

<parmname>--logger</parmname>=<varname>json</varname> to generate a strucured log in JSON format. Each log
message generates a JSON object on its own line.
<p>If log is written to a file with <parmname>--logfile</parmname>, the log will be generated as a JSON
array where each log message is JSON object as an array item.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
array where each log message is JSON object as an array item.</p></li>
array where each log message is a JSON object as an array item.</p></li>

log disabled colored output.</p>
<p>If log is written to a file with <parmname
>--logfile</parmname>, the log will be generated as a JSON array
where each log message is JSON object as an array item.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
where each log message is JSON object as an array item.</p>
where each log message is a JSON object as an array item.</p>

</pt>
<pd>
<p>Generate a strucured log in JSON format. Each log message generated a JSON object on its own line. JSON
log disabled colored output.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log disabled colored output.</p>
logging disables colored output.</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes to an existing topic or feature
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants